Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The game of Pig Pig is a folk jeopardy dice game with simple rules: Two players

ID: 3638630 • Letter: T

Question

The game of Pig

Pig is a folk jeopardy dice game with simple rules: Two players race to reach 100 points. Each turn, a player repeatedly rolls a die until either a 1 ("pig") is rolled or the player holds and scores the sum of the rolls (i.e. the turn total). At any time during a player's turn, the player is faced with two decisions:

roll - if the player rolls
1: the player scores nothing and it becomes the opponents turn.
2 - 6: the number is added to the player's turn total and the player's turn continues.
hold - The turn total is added to the player's score and it becomes the opponent's turn.
Assignment specifications

For this assignment you will simulate a given number of hold-at-20 turns, and report the estimated probabilities of the possible scoring outcomes.

Input Format

Enter a single positive integer indicating the number of turns simulated. (Larger numbers will tend to yield better estimations.)
Output Format

Initially, prompt the user with "Hold-at-20 turn simulations? ".
On the next line, print "Score" and "Estimated Probability" separated by a tab.
After the simulations, print a table line for each score outcome that occurred in increasing order of score. For each score outcome, print the score, a tab, and the fraction of turn simulations that yielded that score.
Sample Output (input underlined)

Hold-at-20 turn simulations? 10000000
Score Estimated Probability
0 0.624896
20 0.099483
21 0.095041
22 0.074062
23 0.054203
24 0.035110
25 0.017204

By the way, if you seed the random function with the value 1000 (instead of time(NULL)) you will get these EXACT values.

Explanation / Answer

The game of Pig is a very simple jeopardy dice game in which two players race to reach 100 points. Each turn, a player repeatedly rolls a die until either a 1 is rolled or the player holds and scores the sum of the rolls (i.e. the turn total). At any time during a player's turn, the player is faced with two decisions: roll - If the player rolls a 1: the player scores nothing and it becomes the opponent's turn. 2 - 6: the number is added to the player's turn total and the player's turn continues. hold - The turn total is added to the player's score and it becomes the opponent's turn. Instructions: You are playing against the computer. The blue rectangle indicates the current player. To roll, click or the die in the lower left corner. To hold, click . Click and hold the "Hint" button to display the optimal decision. When the applet starts running, it starts computing the probability that you will win. As soon as the probabilities are computed, they will display. The key decision facing a player is how large a turn total should be risked to possibly get an even larger total. To learn more about the game of Pig, visit our Pig web page. An iPhone Pig Dice app with optimal play is also available.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote