Question: Using the Die class, design and implement a game called Pig. In this game, the user competes against the computer. On each turn, the current
Using the Die class, design and implement a game called Pig. In this game, the user competes against the computer. On each turn, the current player rolls a pair of dice and accumulates points. The goal is to reach points before your opponent does. If on any turn, the player rolls a all points accumulated for that round are forfeited and control of the dice moves to the other player. If the player rolls two s in one turn, the player loses all points accumulated thus far in the game and loses control of the dice. The player may voluntarily turn over the dice after each roll. Therefore, the player must decide to either roll again be a pig and risk losing points, or relinquish control of the dice, possibly allowing the other player to win. Implement the computer player such that it always relinquishes the dice after accumulating or more points in any given round.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
