Craps. The following are the rules for a pass bet in the game of craps. Roll two
Question:
Craps. The following are the rules for a pass bet in the game of craps. Roll two six-sided dice, and let \(x\) be their sum.
- If \(x\) is 7 or 11 , you win.
- If \(x\) is 2,3 , or 12 , you lose.
Otherwise, repeatedly roll the two dice until their sum is either \(x\) or 7 .
- If their sum is \(x\), you win.
- If their sum is 7, you lose.
Write a modular program to estimate the probability of winning a pass bet. Modify your program to handle loaded dice, where the probability of a die landing on 1 is taken from the command line, the probability of landing on 6 is \(1 / 6\) minus that probability, and 2-5 are assumed equally likely. Hint: Use StdRandom . di screte().
Step by Step Answer:
Introduction To Programming In Java An Interdisciplinary Approach
ISBN: 9780672337840
2nd Edition
Authors: Robert Sedgewick, Kevin Wayne