Limit 33

limit33“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

  1. A player starts with a total of zero.
  2. On each turn a random number between 1 and 10 is generated and added to the player’s total.
  3. If the player’s total exceeds 33, the player has lost and the game ends: Game Over.
  4. At the end of each turn the player is asked whether they want to complete another turn or quit.
  5. 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!

Flowchart


limit 33 flowchart

Your Challenge


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.

Share Button
Posted in Computer Science, Python - Intermediate, Python Challenges Tagged with: ,

Our Latest Book