Assignment: Write algorithms and programs to play ‘non-betting’ Craps. Craps is a game played with a pair of dice. In the game, the shooter (the player with the dice) rolls a pair of dice and the number of spots showing on the two upward faces are added up. If the opening roll (called the ‘coming-out’ roll) is a 7 (‘natural’) or 11 (‘yo-leven’), the shooter immediately wins the game. If the coming-out roll results in a 2 (‘snake eyes’), 3 (‘ace deuce’) or 12 (‘box cars’), then the shooter immediately loses the game (‘craps out’). Otherwise, the game continues and the total for the coming-out roll becomes the ‘point’. If the shooters rolls the point before rolling a 7, the shooter wins. If the shooter rolls a 7 before re-rolling the point, the shooter loses, otherwise the game continues. The shooter will continue to roll until they win or lose. Refer to https://en.wikipedia.org/wiki/Craps for the basics and typical names for the sum of the die rolls. Typical play-game pseudocode:
reset game;
roll two dice and sum;
increment number of rolls;
point = sum;
if (point is 7 or is 11)
game is won;
else if (point is (not 2), is (not 3) and is (not 12)) {
do {
roll two dice and sum;
increment number of rolls;
value = sum;
} while (value is (not point) and is (not 7));
if (value is point)
game is won;
else
game is lost;
else
game is lost;
}
Output: Output will provide the analysis of running a certain number of games of Craps – presented in clear, aligned, readable and attractive manner. The (win/lose) results of each game and the number of rolls will be recorded by the Analyzer class in order to facilitate an analysis of the game of Craps. Displayed analysis will include data points for: