“Limit 33” is a simple game of adding a series of random numbers to a running total. The player’s aim it to reach a total as close as possible to 33 without taking this total over 33.
Rules of the Game
- A player starts with a total of zero.
- On each turn a random number between 1 and 10 is generated and added to the player’s total.
- If the player’s total exceeds 33, the player has lost and the game ends: Game Over.
- At the end of each turn the player is asked whether they want to complete another turn or quit.
- If they quit, the player is given a score as follows:
- Zero point if their total is below 24 or above 33.
- 10 x (total – 23) points if their total is between 24 to 33.
For instance with a total of 29, the player would score 10 x (29-23) = 60 points. The maximum score they can reach is 10 x (33-23) = 100 when they reach a total of 33!
For this challenge, you will create the Python code for this game. You can use the flowchart given above to help you with your code.