Learn R Programming

TeachingDemos (version 2.13)

petals: Play the Petals Around the Rose game

Description

This plays the lateral thinking game Petals Around the Rose. This is a game where 5 regular dice are rolled and the players then try to figure out how many petals are around the rose.

Usage

petals(plot = TRUE, txt = TRUE)

Value

This function only returns NULL, it is run for its side effects.

Arguments

plot

Should the dice be plotted to the current/default graphics device.

txt

Should the dice be shown in the console window using text.

Author

Greg Snow, 538280@gmail.com

Details

At least one of the arguments plot and txt needs to be true, otherwise you will be guessing blind (or testing your psychic abilities).

The game is usually played with 5 physical dice, one person who knows the rules (the potentate of the rose, here the computer), and one or more players trying to learn the puzzle. The potentate can only give the players the following 3 rules:

  1. The name of the game is "Petals Around the Rose" and the name is significant.

  2. The answer is always 0 or an even number.

  3. The potentate can tell the answer for any roll after any guesses are made.

The potentate (or other player) then rolls the 5 dice and any players are then allowed to guess. The potentate either confirms a correct guess or tells the correct answer, then the game continues with another roll. Players are not to discuss their reasoning so that each can solve it themselves. When a player thinks they have worked out the reasoning they demonstrate it by getting correct guesses, but not by discussing it with anyone. Generally 6 correct guesses in a row is considered evidence that they have figured out the rules and they are then considered a potentate of the rose.

For this implementation the computer will simulate the role of 5 dice and display the results and ask for a guess of how many petals are around the rose. The player then enters their guess and the computer then either confirms that it is correct or gives the correct answer.

Pressing enter without making a guess ends the game.

References

http://www.borrett.id.au/computing/petals-bg.htm

See Also

dice

Examples

Run this code
if(interactive()){
  petals()
}

Run the code above in your browser using DataLab