Design and implement a class to play a modified version of


Question: Design and implement a class to play a modified version of a game called Pig. In this game 3 dice are used. You will write a modified version of the Dice class from Lab 5 so that the 3 dice are stored in an array, not as individual integers. The user will compete against the computer. The goal is to reach 100 points before the computer does. On each turn, the current player (user or computer) rolls the dice and accumulates points. If, on any turn, the player/computer rolls two 1s, all points accumulated for that round are forfeited and the turn is over. If the player/computer rolls three 1s in one turn, the player/computer loses all points accumulated thus far in the game and the turn is over. The player may choose to end his/her turn after any roll or choose to continue rolling (be a pig) and risk losing points. The computer's turn will end when the total points accumulated for the turn is 20 or more. The game ends when either the computer or the player reaches 100 points after the end of a round (ie. if the player reaches 100 points, the computer still the last turn). Your program should indicate the winner or that there was a tie.

Solution Preview :

Prepared by a verified Expert
C/C++ Programming: Design and implement a class to play a modified version of
Reference No:- TGS02537052

Now Priced at $15 (50% Discount)

Recommended (90%)

Rated (4.3/5)