Roulette (Betting Game)

rouletteRules of the Game

A player starts the game with 10 chips.

For each game the player should be asked how many chips they want to bet. They should not be allowed to bet more chips than they actually own.

Then the user should be asked which number they want to bet on (between 0 and 10)

The user should be asked which colour they want to bet on:

  • Green (Number 0)
  • Red (for odd numbers)
  • Black (for even numbers)

The computer program should then “spin the wheel” by generating a random number between 0 and 10.

  • If the number generated matches the user’s number then the user should be given 10 times their initial bet.
  • If the number generated matches the user’s colour (green for 0, red for an odd number, black for an even number) then the user should be given twice their initial bet.
  • If none of the above two conditions are met, the user loses their bet.

At the end of each bet, the program should display the user’s total number of chips.

The player should be able to carry on playing for as long as they want unless they have lost all their chips. In this case the game should end.

Complete the code below to finish this game:



The solution for this challenge is available to full members!
Find out how to become a member:
➤ Members' Area

Did you like this challenge?

Click on a star to rate it!

Average rating 3.3 / 5. Vote count: 16

No votes so far! Be the first to rate this post.

As you found this challenge interesting...

Follow us on social media!