Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

using python You will write a program that simulates using different betting strategies in the game of roulette (Links to an external site.)Links to an

using python

You will write a program that simulates using different betting strategies in the game of roulette (Links to an external site.)Links to an external site.. In American style roulette, there is a wheel with the numbers 0 to 36 and a 00 as well. A dealer spins the wheel and then drops a ball onto the wheel where it will eventually land on one of the 38 possible numbers.

Below is the roulette betting table. Before a spin of the wheel, players can place chips in different locations to signify different types of bets. For this simulation, we're concerned with three types of bets: (1) betting on a single number (e.g., 7), (2) betting on even (even numbers from 2 to 36) or odd (odd numbers from 1 to 35), and (3) betting on a dozen numbers (i.e., 1st 12 is numbers 1 to 12, 2nd 12 is numbers 13 to 24, 3rd 12 is numbers 25 to 36). Note that for all the even/odd bets and dozen bets that if the winning number is 0 or 00 then any bet is a losing bet.

image text in transcribed

If you place a bet and do not win, then you lose the amount of money you bet. If you place a winning bet then you receive your bet back plus some payout amount times your bet. Each type of bet has its own payout schedule. For example:

Single numbers have a 35 to 1 payout. If you place a bet of $2 on the number 7, and 7 is the winning number, you receive your $2 bet back plus $70.

Even or odd bets have a 1 to 1 payout. If you place a bet of $2 on odd and the winning number is 7, which is an odd number, you receive your $2 bet back plus $2.

Dozen bets have a 2 to 1 payout. If you place a bet of $2 on 1st 12 and the winning number is 7, which is in the 1st 12 numbers, you receive your $2 bet back plus $4.

Your goal is to write a program that simulates betting for some given number of roulette wheel spins using a strategy chosen by the user. The user should input, in this order:

the number of dollars they start with

the number of spins they will play

the number of dollars they will bet on each spin

their strategy choice

Any information required for their strategy choice (e.g., the number to bet on for the single number strategy)

The program should then simulate spinning the wheel, determining if the player's bet is a winning bet, then paying out as appropriate. The simulation should stop when the number of desired spins is reached or out the player runs out of money (i.e., their personal bank is $0 or less).

When the simulation is complete, the program should output:

the total number of spins, which may be less than the desired spins if the player runs out of out money to bet

the toal wins and winning percentage

the total losses and losing percentage

the amount of money the player has left in their bank

the net winnings (i.e., you started with $1000, ended with $750, thus the net winnings is -$250)

Example Simulation 1

Enter the number of dollars you start with: 1000 Enter the number of spins you will play: 1000 Enter how many dollars you will bet for each spin: 1 Choose one of the following strategy choices - Bet on a (s)ingle number (pays 35 to 1) - Bet on (e)ven or odd numbers (pays 1 to 1) - Bet on a (d)ozen numbers (pays 2 to 1) Enter your strategy choice (s, e, d): d Enter 1 to bet on numbers 1-12, 2 for numbers 13-24, or 3 for numbers 25-36: 3 After 1000 spins Wins: 316 (31.60%) Losses: 684 (68.40%) Ending bank: 948 Net winnings: $-52

Example Simulation 2

Enter the number of dollars you start with: 1000 Enter the number of spins you will play: 1000 Enter how many dollars you will bet for each spin: 5 Choose one of the following strategy choices - Bet on a (s)ingle number (pays 35 to 1) - Bet on (e)ven or odd numbers (pays 1 to 1) - Bet on a (d)ozen numbers (pays 2 to 1) Enter your strategy choice (s, e, d): s Enter the single number you want to bet on (00 or 0 to 36): 7 After 1000 spins Wins: 23 (2.30%) Losses: 977 (97.70%) Ending bank: 140 Net winnings: $-860

Example Simulation 3

Enter the number of dollars you start with: 1000 Enter the number of spins you will play: 1000 Enter how many dollars you will bet for each spin: 25 Choose one of the following strategy choices - Bet on a (s)ingle number (pays 35 to 1) - Bet on (e)ven or odd numbers (pays 1 to 1) - Bet on a (d)ozen numbers (pays 2 to 1) Enter your strategy choice (s, e, d): e Enter if you want to bet on (e)ven or (o)dd numbers: o After 274 spins Wins: 117 (42.70%) Losses: 157 (57.30%) Ending bank: 0 Net winnings: $-1000
1st 12 2nd 12 3rd 12 1 to 18 EVEN RED ' I ' BLACK ODD 19 to 36

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

More Books

Students also viewed these Databases questions

Question

2. What should an employer do when facing an OSHA inspection?

Answered: 1 week ago