Menu

(Solved) : Game Pig Simple Two Player Dice Game First Player Reach 100 Points Wins Players Take Turns Q31474603 . . .

The game of Pig is a simple two-player dice game in which thefirst player to reach 100 or more points wins. Players take turns.On each turn a player rolls a six-sided die. After each roll: a) Ifthe player rolls a 1 then the player gets no new points and itbecomes the other player’s turn. b) If the player rolls 2-6 thenthey can either roll again or hold. If the player holds the sum ofall rolls is added to his/her score and the turn passes to theother player. Write a program that plays the game of Pig where oneplayer is human and the other is the computer. When it is thehuman’s turn the program should show the score of both players andthe previous roll. Allow the human to input “r” for roll again and“h” for hold. (Hint: use the input function). When it is thecomputer’s turn you need not do any prompting. Simply keep rollinguntil the computer has earned 20 or more points and then hold. Ifthe computer rolls a 1 at any time then the turn is lost and nopoints are added to the score. If at any point the computer hasenough points to win the game then the computer holds and the gameends. Allow the human player to roll first. A random roll can besimulated with a call to random.randint(1,6) which generates auniform random number in [1,6]. Make sure to import the randommodule (ie. import random). Use an alternative to the deffunction. Do NOT use def. Also, make itpretty easy please. This has to be in PYTHONprogram.

Expert Answer


Answer to Game Pig Simple Two Player Dice Game First Player Reach 100 Points Wins Players Take Turns Q31474603 . . .

OR