The thinking game Petals around the Rose is played with five dice. It is played by a computer program or with real dice that are thrown by a Potentate of the Rose, a person who knows the secret behind the game. For each roll of the dice, there is a unique numerical solution. The players have to try to figure out the right solution through inductive reasoning. If they fail to guess the right solution, the correct solution is communicated by the Potentate of the Rose, and they must try to guess the right solution at the next throw.

bloemblaadjes rond de roos
The game has only three rules:

Assignment

In order not to reveal the secret of the game we have stored the correct answer to the question how many petals there are around the rose in the flowerpetals.txt file. Each line of this file contains six integers, which are separated by a single space from each other. The first five integers each time indicate the number of eyes for a possible roll of five dice, while the sixth number indicates to how many petals this throw corresponds. Because the number of petals is independent of the order of the dice (oops, now we have already revealed a part of the solution) we have sorted the first five numbers each in ascending order, so that we only need to include a single line in the file if the order of the dice is the only thing that differs.

Example

>>> solutions = readSolutions('flowerpetals.txt')
>>> solutions
{(1, 1, 1, 2, 3): 2, (5, 5, 5, 5, 6): 16, ..., (1, 3, 4, 4, 4): 2}
>>> potentate([3, 5, 5, 4, 3], solutions)
12
>>> potentate([6, 5, 3, 4, 2], solutions)
6