# Commits

committed 3f37290

Started writing the analysis.

• Participants
• Parent commits fd9bb70

# File project-euler/121/121-planning.txt

`+Problem:`
`+--------`
`+`
`+{{{`
`+A bag contains one red disc and one blue disc. In a game of chance a player`
`+takes a disc at random and its colour is noted. After each turn the disc is`
`+returned to the bag, an extra red disc is added, and another disc is taken at`
`+random.`
`+`
`+The player pays £1 to play and wins if they have taken more blue discs than red`
`+discs at the end of the game.`
`+`
`+If the game is played for four turns, the probability of a player winning is`
`+exactly 11/120, and so the maximum prize fund the banker should allocate for`
`+winning in this game would be £10 before they would expect to incur a loss.`
`+Note that any payout will be a whole number of pounds and also includes the`
`+original £1 paid to play the game, so in the example given the player actually`
`+wins £9.`
`+`
`+Find the maximum prize fund that should be allocated to a single game in which`
`+fifteen turns are played.`
`+}}}`
`+`
`+There are two possible states:`
`+`
`+S1) 1 B + 1 R .`
`+`
`+S2) 2 R.`
`+`
`+The state machine is:`
`+`
`+S1 -> S1 - 2/3`
`+`
`+S1 -> S2 - 1/3`
`+`
`+S2 -> S1 - 0`
`+`
`+S2 -> S2 - 1/1`
`+`
`+The output is:`
`+`
`+Out[S1] = B -> 1/2`
`+Out[S1] = R -> 1/2`
`+Out[S2] = B -> 0`
`+Out[S3] = R -> 1/1`
`+`