Question: C++ Write a function that plays a game of craps. The function declares the random engine and the uniform distribution as static local variables. The
C++ Write a function that plays a game of craps. The function declares the random engine and the uniform distribution as static local variables. The function has 2 reference parameters
1) the number of times the player rolled the dice
2) the sum of the dice if the player won or lost on the first roll or
the player's point if the player won or lost on a succeeding roll.
The function returns true if the player won the game and false if the player lost the game.
Write a program that invokes the previously defined function N times where N is a very large number. The program counts the number of times that each dice sum wins and the number of times that each dice sum loses. Write the function so that 2, 3, and 12 always lose on the first roll and never win on subsequent rolls; 7 and 11 always win on the first roll and never lose on subsequent rolls; and 4, 5, 6, 8, 9, and 10 sometimes win and some times lose.
What are dice or what is a die the singular form of dice? A die is a cube of some hard, durable material, usually white in color. On each face of a die are a number of spots, usually black in color, arranged symmetrically on the face, each face having a different number of spots, ranging in number from one to six.
The Game of Craps
One player plays until he wins or loses. The player rolls a pair of dice on the ground and counts the number of spots on the upper most faces of the dice. A player either wins or loses, as craps allows no tie games. A player wins, loses or defines his point on the first roll of the dice. A player who defines his point continues to roll the dice until he wins or loses. A player who rolls 7 or 11 on the first roll wins. A player who rolls 2, 3 or 12 loses on the first roll. A player who rolls anything else - 4, 5, 6, 8, 9, 10, or 12 - defines his point and rolls until he rolls his point again and wins or rolls 7 and loses.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
