Question
Write a Ruby program to simulate a roulette wheel and determine if one can double their money by doubling up on their losing bets. On
Write a Ruby program to simulate a roulette wheel and determine if one can double their money
by doubling up on their losing bets.
On a roulette wheel (using the double
zero layout)
there are
38 slots for the ball to fall in.
18 are colored black, 18 are colored red, and 2 are colored green.
If
you bet on red or black, the payoff is 1 to 1, but the odds are slightly less than 50% (which is how
the house makes money).
Below is a pi
cture of a standard double
zero wheel:
Your goal is to write a ruby program that simulates the spining
of a roulette wheel (for which you
will use a random generator), the betting on one color, and the decision of where there is a payoff
or not.
You will also simulate the double of the losing bet, and resetting back to the base bet after
winning. You also
need to keep track of the total amount of money you have (which will call your
bank) to determine if you
can make the next bet or not.
Then you want to see if you can double
your bank of
money by using this strategy.
You also need to have the correct odds
(the correct
number of slots and correct color) as well as the correct pay off.
When you lose, you lose your
bet.
When you win, you keep your bet, plus earn the same as your bet (i.e. double your bet).
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started