Petals Around The Rose
December 18, 2012
Today’s exercise is our 400th, and our tradition on these anniversaries is to play a game. Today we choose Petals Around The Rose. Here’s a sample game:
Let's play 'Petals Around The Rose.'
The name of the game is significant.
At each turn I will roll five dice,
then ask you for the score, which
will always be zero or an even number.
After you guess the score, I will tell
you if you are right, or tell you the
correct score if you are wrong. The game
ends when you prove that you know the
secret by guessing the score correctly
six times in a row.The five dice are: 4 2 5 5 4.
What is the score? 6
The correct score is 8.The five dice are: 2 5 1 3 3.
What is the score? 8
CorrectThe five dice are: 2 5 2 5 6.
What is the score? 8
CorrectThe five dice are: 6 2 5 3 2.
What is the score? 8
The correct score is 6.The five dice are: 4 2 1 1 2.
What is the score? 6
The correct score is 0.The five dice are: 5 6 3 6 6.
What is the score? 6
CorrectThe five dice are: 2 6 2 2 4.
What is the score? 6
The correct score is 0.The five dice are: 3 2 4 2 1.
What is the score? 0
The correct score is 2.The five dice are: 4 4 2 6 3.
What is the score? 2
CorrectThe five dice are: 2 1 5 1 5.
What is the score? 8
CorrectThe five dice are: 1 5 5 2 4.
What is the score? 8
CorrectThe five dice are: 5 2 4 6 3.
What is the score? 6
CorrectThe five dice are: 1 6 1 5 3.
What is the score? 6
CorrectThe five dice are: 1 4 3 2 6.
What is the score? 2
CorrectCongratulations! You are now a member
of the Fraternity of the Petals Around
The Rose. You must pledge never to
reveal the secret to anyone.
You can play Petals Around The Rose on the internet, or read about Bill Gates’ encounter with the game.
Your task is to figure out the secret, then write a program to play Petals Around The Rose. When you are finished, you are welcome to read or run a suggested solution, or to post your own solution or discuss the exercise in the comments below.