Craps is a gambling game based on repeatedly rolling 2 dice. You win or lose depending on the sum of the 2 dice and the occurrence of a desired sum before an undesired sum. There is no skill involved. The outcome is entirely based on the outcome of the sequence of rolls.
For this program you are going to write a simulator that uses random numbers to simulate the craps game. Here are some example rounds: 1st roll Rest of the game. [4,3] [5,6] [1,1] [2,1] [6,6] [4,2] [1,3] [3,6] [5,3] 7 you win 11 you win 2 you lose 3 you lose 12 you lose point=6 [6,2][5,4][1,5] 6 you win point=4 [6,2][4,4][2,6][5,6][6,4][3,1] 4 you win point=9 [6,6][5,6][2,5] 7 you lose point=8 [3,2][1,4][4,2][3,6][5,1][4,1][3,1][4,3] 7 you lose
* If on the first roll you get a sum of 7 or 11, you win. * If on the first roll you get a sum of 2, 3, or 12, you lose. * Otherwise the sum of the first 2 dice is called the "point". * You now roll repeatedly until you get a sum that equals the point, in which case you win, or you get a sum of 7, in which case you lose.
Program Requirements (30 points):
* Your craps method will have multiple return points depending on the what happens with the dice. * I suggest you use a do-while loop for those cases where the initial roll is not an immediate winner or loser. This is a natural way to write it because you are rolling until you reach the stopping condition. * The results are random, but expect the number of winning rounds to be between 35 and 60 wins. If your results are outside of this range, you are either very lucky, very unlucky, or something is wrong with your simulation.
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.