Question: When playing craps, a player rolls two dice repeatedly until she wins or loses. The fi rst roll of the dice is called the come-out
When playing craps, a player rolls two dice repeatedly until she wins or loses. The fi rst roll of the dice is called the come-out roll. If the player rolls a 7 or an 11 on the come-out roll, then she wins immediately; a 2, 3, or 12 on the come-out roll results in an immediate loss. If she rolls a 4, 5, 6, 8, 9, or 10 on the come-out roll, then that number becomes her point and she continues rolling until she rolls either her point or a 7. If she rolls her point, she wins, but if she rolls a 7 before rolling her point, she loses. Once a player has established her point, no other numbers (including 2, 3, 11, or 12) affect her winning or losing. Write a method boolean craps() that simulates one game of craps and returns true if and only if the player wins. Test your method by printing the values of each roll of the dice. When you are convinced that your simulation is correct, include this method in a program that executes craps() 1000 times and reports the percentage of wins.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
