Assignment 6 - SKUNK with class

due November 13th

The purpose of this assignment is to give you practice writing classes, functions, and program planning and development.

The Rules of the Game

  • The game ends when any player gets 100 or more points. 
  • The players take turns and each turn may consist of one or more rolls of the dice.
  • The turn ends either voluntarily or if the user rolls a 1 on one or both dice.
  • The player earns the sum of all rolls taken during his/her turn unless a 1 is rolled on either dice. These points are added to the player's cumulative total points.
  • The points for a roll is the sum of both dice, unless a 1 is rolled. If a 1 is rolled, the roll is counted as 0 points and the turn ends.  If two 1s are rolled (that's a SKUNK), the point total for the turn is 0 and the total points for that player is reset to 0.

Program requirements

  1. Your game must be written for 3 players.
  2. You must use a Player class containing at least the 3 data members indicated below.
  3. Your output should look "quite similar" to that shown below, including player names, results of each roll, totals for each turn, and an announcement of the winner.  Of course, your random game play will be different.
  4. Your solution must contain at least two Player member functions.
  5. The three players must each have different personalities. The personalites are
    • Tom is a "chicken". He will only roll one time for his turn.
    • Dick is a little more daring. He will attempt to roll three times during his turn.
    • Harry is "wild and crazy". He will attempt to keep rolling until he wins or a 1 is rolled, ending the turn.
  6. Make sure you end the game as soon as a player reaches 100 (or more) points, even if the player has not completed the number of rolls for his/her turn.
Skunk

Player Class

class Player
{
    string name;
    int points;
    int numberOfRollsPerTurn;
...
};

Additional comments

This is not an easy assignment. There is significant planning involved. Study the sample output below to make sure you understand the logic of the game.


Sample output

Tom, it is your turn
   You rolled 3 and 6.  That's 9
  Points for the turn = 9.  Total points = 9

Dick, it is your turn
   You rolled 4 and 5.  That's 9
   You rolled 4 and 5.  That's 9
   You rolled 3 and 1.  That's 0
  Points for the turn = 0.  Total points = 0

Harry, it is your turn
   You rolled 2 and 1.  That's 0
  Points for the turn = 0.  Total points = 0

Tom, it is your turn
   You rolled 3 and 3.  That's 6
  Points for the turn = 6.  Total points = 15

Dick, it is your turn
   You rolled 6 and 6.  That's 12
   You rolled 3 and 5.  That's 8
   You rolled 4 and 6.  That's 10
  Points for the turn = 30.  Total points = 30

Harry, it is your turn
   You rolled 2 and 5.  That's 7
   You rolled 2 and 4.  That's 6
   You rolled 5 and 3.  That's 8
   You rolled 2 and 5.  That's 7
   You rolled 3 and 3.  That's 6
   You rolled 1 and 1.  That's  a SKUNK!!!
  Points for the turn = 0.  Total points = 0

Tom, it is your turn
   You rolled 3 and 2.  That's 5
  Points for the turn = 5.  Total points = 20

Dick, it is your turn
   You rolled 6 and 1.  That's 0
  Points for the turn = 0.  Total points = 30

Harry, it is your turn
   You rolled 2 and 1.  That's 0
  Points for the turn = 0.  Total points = 0

Tom, it is your turn
   You rolled 3 and 1.  That's 0
  Points for the turn = 0.  Total points = 20

Dick, it is your turn
   You rolled 2 and 4.  That's 6
   You rolled 1 and 2.  That's 0
  Points for the turn = 0.  Total points = 30

Harry, it is your turn
   You rolled 5 and 2.  That's 7
   You rolled 3 and 5.  That's 8
   You rolled 1 and 3.  That's 0
  Points for the turn = 0.  Total points = 0

Tom, it is your turn
   You rolled 1 and 5.  That's 0
  Points for the turn = 0.  Total points = 20

Dick, it is your turn
   You rolled 3 and 6.  That's 9
   You rolled 1 and 3.  That's 0
  Points for the turn = 0.  Total points = 30

Harry, it is your turn
   You rolled 6 and 3.  That's 9
   You rolled 1 and 5.  That's 0
  Points for the turn = 0.  Total points = 0

Tom, it is your turn
   You rolled 5 and 6.  That's 11
  Points for the turn = 11.  Total points = 31

Dick, it is your turn
   You rolled 6 and 1.  That's 0
  Points for the turn = 0.  Total points = 30

Harry, it is your turn
   You rolled 1 and 1.  That's  a SKUNK!!!
  Points for the turn = 0.  Total points = 0

Tom, it is your turn
   You rolled 4 and 4.  That's 8
  Points for the turn = 8.  Total points = 39

Dick, it is your turn
   You rolled 3 and 4.  That's 7
   You rolled 6 and 2.  That's 8
   You rolled 4 and 5.  That's 9
  Points for the turn = 24.  Total points = 54

Harry, it is your turn
   You rolled 6 and 3.  That's 9
   You rolled 1 and 6.  That's 0
  Points for the turn = 0.  Total points = 0

Tom, it is your turn
   You rolled 1 and 4.  That's 0
  Points for the turn = 0.  Total points = 39

Dick, it is your turn
   You rolled 6 and 6.  That's 12
   You rolled 1 and 2.  That's 0
  Points for the turn = 0.  Total points = 54

Harry, it is your turn
   You rolled 2 and 6.  That's 8
   You rolled 3 and 4.  That's 7
   You rolled 4 and 2.  That's 6
   You rolled 1 and 5.  That's 0
  Points for the turn = 0.  Total points = 0

Tom, it is your turn
   You rolled 3 and 6.  That's 9
  Points for the turn = 9.  Total points = 48

Dick, it is your turn
   You rolled 3 and 5.  That's 8
   You rolled 2 and 6.  That's 8
   You rolled 4 and 1.  That's 0
  Points for the turn = 0.  Total points = 54

Harry, it is your turn
   You rolled 3 and 6.  That's 9
   You rolled 3 and 4.  That's 7
   You rolled 6 and 3.  That's 9
   You rolled 5 and 3.  That's 8
   You rolled 2 and 1.  That's 0
  Points for the turn = 0.  Total points = 0

Tom, it is your turn
   You rolled 5 and 4.  That's 9
  Points for the turn = 9.  Total points = 57

Dick, it is your turn
   You rolled 5 and 4.  That's 9
   You rolled 6 and 6.  That's 12
   You rolled 6 and 3.  That's 9
  Points for the turn = 30.  Total points = 84

Harry, it is your turn
   You rolled 2 and 1.  That's 0
  Points for the turn = 0.  Total points = 0

Tom, it is your turn
   You rolled 6 and 3.  That's 9
  Points for the turn = 9.  Total points = 66

Dick, it is your turn
   You rolled 1 and 4.  That's 0
  Points for the turn = 0.  Total points = 84

Harry, it is your turn
   You rolled 2 and 3.  That's 5
   You rolled 6 and 4.  That's 10
   You rolled 1 and 5.  That's 0
  Points for the turn = 0.  Total points = 0

Tom, it is your turn
   You rolled 2 and 2.  That's 4
  Points for the turn = 4.  Total points = 70

Dick, it is your turn
   You rolled 2 and 6.  That's 8
   You rolled 6 and 1.  That's 0
  Points for the turn = 0.  Total points = 84

Harry, it is your turn
   You rolled 3 and 1.  That's 0
  Points for the turn = 0.  Total points = 0

Tom, it is your turn
   You rolled 5 and 6.  That's 11
  Points for the turn = 11.  Total points = 81

Dick, it is your turn
   You rolled 4 and 6.  That's 10
   You rolled 1 and 2.  That's 0
  Points for the turn = 0.  Total points = 84

Harry, it is your turn
   You rolled 3 and 3.  That's 6
   You rolled 4 and 5.  That's 9
   You rolled 4 and 1.  That's 0
  Points for the turn = 0.  Total points = 0

Tom, it is your turn
   You rolled 5 and 5.  That's 10
  Points for the turn = 10.  Total points = 91

Dick, it is your turn
   You rolled 1 and 4.  That's 0
  Points for the turn = 0.  Total points = 84

Harry, it is your turn
   You rolled 1 and 1.  That's  a SKUNK!!!
  Points for the turn = 0.  Total points = 0

Tom, it is your turn
   You rolled 1 and 3.  That's 0
  Points for the turn = 0.  Total points = 91

Dick, it is your turn
   You rolled 2 and 3.  That's 5
   You rolled 2 and 1.  That's 0
  Points for the turn = 0.  Total points = 84

Harry, it is your turn
   You rolled 5 and 1.  That's 0
  Points for the turn = 0.  Total points = 0

Tom, it is your turn
   You rolled 3 and 5.  That's 8
  Points for the turn = 8.  Total points = 99

Dick, it is your turn
   You rolled 4 and 3.  That's 7
   You rolled 2 and 4.  That's 6
   You rolled 4 and 3.  That's 7
  Points for the turn = 20.  Total points = 104


Dick won the game with 104 points.