Problem 1 The Gambler’s Ruin Simulator In this assignment you will learn that ultimately every gambler playing a game of

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Problem 1 The Gambler’s Ruin Simulator In this assignment you will learn that ultimately every gambler playing a game of

Post by answerhappygod »

Problem 1
The Gambler’s Ruin Simulator
In this assignment you will learn that ultimately every gambler
playing a game of luck is destined to lose if the game is played
long enough.
In the game of roulette, a game of pure chance that does not
involve any skill, players can place many different kinds of bets:
They can bet on individual numbers, rows or columns of numbers, red
or black, even or odd, etc. Each type of bet has its own odds and
payback.
For this assignment we will assume a player is betting on the
group of red numbers. The probably of winning is 18/37 and the
probability of losing is 19/37 (the number 0 has color green). If
the number that comes up is red the player wins they get twice the
amount they bet. If they lose because a black number or 0 (green)
comes up, the player loses the entire amount they bet.
Write code that simulates many games of roulette in which the
player always bets on red.
In the beginning the user should be asked for a starting amount
the player has and the amount the player is going to bet in every
game. For example, a player may start with $1,000, and he may
decide to bet $10 in every game.
Your program should then simulate one round the game at the end
of which the player will either win or lose their bet. Update the
amount of money the player has and if the amount is still larger
than $0, play again.
If print out the amount the player has after every game
played.
When the player’s amount reaches $0, print out how many times
the player played, how many
rounds were won, and how many were lost.
Also show some creativity and develop a way to show the player’s
progress, the size of their stash
by means of some tasteful graphical output.
Submission Instructions
Upload an MS Word document file (.DOCX) that contains the
following:
Copy paste source code (.CPP/.C file) of your program.
Also include some screenshots of the console window output of
your program.
In addition, please, also upload the .CPP / .C file
separately.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply