1 STAT4004 Project 3 Roulette Games Total points

STAT4004 Project 3 Roulette Games
Total points= 25
Student Name:
Description of the problem: See Page 542 in the textbook (second Edition). You will work on the Game
C: Martingale System.
1) [10 points] Assume you have $100 and you will stop if you either have won $10 or you don’t
have enough money for the next bet. Write a function to simulate the process of playing the
game C once. The input is empty. The outputs contain the number of bets you made, the value
of each bet, the win/lose record of all bets (using 1/0), the net amount of each winning/losing,
your total amount of money when the game is over.
2) [9 points] Write a program that repeat the above game 1e5 times, and numerically approximate
the following quantity.
Quantity
Numerical Approximation
95% CI
1. The expected number of
winnings per game
2. The proportions of games
you win
3. The expected playing time
per game
4. The maximum amount you
can lose
5. The maximum amount you
can win
Note in 2. The proportion of game you win means across 1e5 simulations, what proportion has the
result of winning (not the proportion of winning of all bets.)
3) [3 points] You can plot your balance of money vs. the bet index in each game as one trajectory.
Show the first 1000 trajectories in one plot, using blue indicating all the games you finally win,
and using red to indicating all the games you finally lose.
4) [3 points] Calculate the answers to 4 in 2) exactly and compare with your numerical
approximation.
1