Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For this extra credit assignment you will build a game based on roulette. A roulette wheel has a mix of black and red spots with

For this extra credit assignment you will build a game based on roulette. A roulette wheel has a mix of black and red spots with numbers as shown below.

The program will give the user a series of bets they can wager and then virtually spin the roulette wheel and let them know if they won. The game should support the following roulette bets: red, black, odd, even, high and low.

  • red - wins if the wheel lands on a red spot
  • black - wins if the wheel lands on a black spot
  • odd - wins if the wheel lands on an odd number
  • even - wins if the wheel lands on an even number (Excluding Zero)
  • high - wins if the wheel lands between 19 and 36.
  • low - wins if the wheel lands between 1 and 18.

All of these bets lose when the green zero spot is hit giving the house a slight advantage. The program should look something like this when run.

Create a function get_roulette_color()

  • It should receive a number as input.
  • It should return either red, black or green based on the colors of a roulette wheel.
    • 0 returns green
    • For 1 10, odd numbers return red and even numbers return black.
    • For 11 18, odd numbers return black and even numbers return red.
    • For 19 28, odd numbers return red and even numbers return black.
    • For 29 36, odd numbers return black and even numbers return black.

Create a function called get_high_low()

  • It should receive a number as input.
  • If the number is between 1 18, it should return low
  • If the number is between 19 36, it should return high
  • If the number is 0, it should return zero

Create a function called get_odd_even()

  • It should receive a number as its input.
  • If the number is 0, it should return zero
  • Otherwise, if the number is even, it should return even
  • If the number is odd, it should return odd

Create a function called win()

  • The function should receive inputs of the users bet and the number of the roulette wheel.
  • It should return a Boolean value indicating whether the player has won or not. True if the bet matches the result and False if the bet does not match the result.
  • For color bets, the function should call get_routlette_color() function and use the returned color to compare with the users bet.
  • For odd/even bets, the function should call the get_odd_even() function and use the returned odd or even to compare with the users bet.
  • For the high/low bets, the function should call the get_high_low() function and use the returned value to compare with the users bet.

Create a function called main()

  • The function should explain the game to the user.
  • It should prompt the user to enter their bet.
  • It should generate a random int between 0 and 36 to represent the wheel spin.
  • It should use the get_roulette_color() function to display the color and number of the spin to the user.
  • It should use the win() function to determine if the user won their bet or not and let the user know if they won or lost.

Copy/paste the code into the window and upload your python file here.

For testing, please upload a screenshot of the automated tests OR screenshots of the the following manual tests:

  • A red/black bet winning
  • A red/black bet losing
  • An odd/even bet winning
  • An odd/even bet losing
  • A high/low bet winning
  • A high/low bet losing

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Programming With Visual Basic .NET

Authors: Carsten Thomsen

2nd Edition

1590590325, 978-1590590324

More Books

Students also viewed these Databases questions

Question

1. Let a, b R, a Answered: 1 week ago

Answered: 1 week ago

Question

4. Support and enliven your speech with effective research

Answered: 1 week ago

Question

3. Choose an appropriate topic and develop it

Answered: 1 week ago