Craps is a dice game. To play a game, all players first place their bets on the table.
A player then rolls the dice (perhaps several times to determine the outcome) and
the bets are collected or paid depending on the outcome of the dice rolls. A game
can be won or lost on the first roll (if specific numbers come up), or several rolls
may be necessary. The rules of the game are simple:
" On the first roll,
o If the roll is seven (7) or eleven (11), the game is won.
o If the roll is two (2), three (3) or twelve (12), the game is lost.
o If the roll is any other number, that number becomes ``the point''
and further rolls are necessary to determine the outcome.
" After the point has been determined, subsequent rolls determine the
outcome of the game. For each roll
o If the roll is a seven (7), the game is lost.
o If the roll duplicates the point, the game is won.
o If the roll is any other number, the dice must be rolled again in an
attempt to determine the outcome.
It may take several rolls of the dice to determine the outcome of a game. The
longer it takes to duplicate the point, the more money is on the table.
A player is allowed to bet any amount before each roll of the dice. In this project,
we will assume a simplified betting system where the player can only bet on a win or
loss of the game. If a win, the house returns to the player the total bet and an
additional amount equal to the total bet. If a loss, the house keeps the players bet.
I need to simulate the playing of this game. Over a large number of games, gather statistics
that can be used to answer the following questions:
1. What is the approximate probability of winning this game?
2. What is the approximate probability that a player will win the game on the
first roll of the dice?
3. What is the approximate probability that a player will lose the game on the
first roll of the dice?
4. Assuming that the player starts with $10,000, and bets one dollar before
each roll (i.e, the strategy shown in the table above), plot the decrease or
increase of the player's money over time.
5. Suppose a player initially bets one dollar, but doubles his bet each time
before the dice is rolled until a win or loss is obtained. Again assume that
the player starts with $10,000, and plot the decrease or increase of the
player's money over time.
6. Plot a histogram of the dice rolls over the course of your simulation to
insure that your dice simulation acts correctly (histogram appropriately
labeled, of course).
For the random dice roll, you should use rand and srand.