Assignment 7 - SKUNK with class

due Tuesday, November 10th 

The purpose of this assignment is to give you practice writing classes, constructors and member functions, 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 are 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 the two classes listed below.  The Player class must also include a constructor.
  3. Your output should look "quite similar" to the sample output 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. The three players must each have different personalities. The personalities are
    • Curly is a "chicken". He will only roll one time for his turn.
    • Larry is a little more daring. He will attempt to roll two times during his turn.
    • Moe is "wild and crazy".  He will attempt to roll four times during his turn.
  5. 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

Required Classes

class Dice
{
    int die1, die2;
public:
    Dice();
    int roll();
};

class Player
{
    string name;
    int rollsPerTurn;
    int points;
public:
...
};

Suggested main function

int main()
{

    Player curly("Curly",1);
    Player larry("larry",2);
    Player moe("Moe",4);

    Dice dice;

    bool gameOver = false;

    while (!gameOver)
    {
        if      (curly.takeTurn(dice) >= 100) gameOver = curly.declareWinner();
        else if (larry.takeTurn(dice) >= 100) gameOver = larry.declareWinner();
        else if (moe.takeTurn(dice) >= 100)   gameOver = moe.declareWinner();
        else { cout << "----------------------------------------------\n";}
    }

    cout << "That's all folks!!!" << endl;
}

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.

Who is Curly, Larry, and Moe?


Sample output

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

larry, it is your turn
   You rolled 5 and 4.  That's 9
   You rolled 6 and 6.  That's 12
  Points for the turn = 21.  Total points = 21

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

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

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

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

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

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

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

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

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

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

---------------------------------------------
Curly, it is your turn
   You rolled 6 and 6.  That's 12
  Points for the turn = 12.  Total points = 22

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

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

---------------------------------------------
Curly, it is your turn
   You rolled 6 and 4.  That's 10
  Points for the turn = 10.  Total points = 32

larry, it is your turn
   You rolled 6 and 4.  That's 10
   You rolled 6 and 2.  That's 8
  Points for the turn = 18.  Total points = 18

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

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

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

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

---------------------------------------------
Curly, it is your turn
   You rolled 6 and 6.  That's 12
  Points for the turn = 12.  Total points = 50

larry, it is your turn
   You rolled 5 and 3.  That's 8
   You rolled 6 and 2.  That's 8
  Points for the turn = 16.  Total points = 16

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

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

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

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

---------------------------------------------
Curly, it is your turn
   You rolled 6 and 6.  That's 12
  Points for the turn = 12.  Total points = 72

larry, it is your turn
   You rolled 2 and 3.  That's 5
   You rolled 5 and 6.  That's 11
  Points for the turn = 16.  Total points = 46

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

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

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

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

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

larry, it is your turn
   You rolled 2 and 2.  That's 4
   You rolled 4 and 5.  That's 9
  Points for the turn = 13.  Total points = 59

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

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

larry, it is your turn
   You rolled 4 and 4.  That's 8
   You rolled 3 and 2.  That's 5
  Points for the turn = 13.  Total points = 72

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

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

larry, it is your turn
   You rolled 6 and 4.  That's 10
   You rolled 5 and 5.  That's 10
  Points for the turn = 20.  Total points = 92

Moe, it is your turn
   You rolled 5 and 2.  That's 7
   You rolled 3 and 6.  That's 9
   You rolled 3 and 2.  That's 5
   You rolled 5 and 4.  That's 9
  Points for the turn = 30.  Total points = 60

---------------------------------------------
Curly, it is your turn
   You rolled 4 and 6.  That's 10
  Points for the turn = 10.  Total points = 102


Curly won the game with 102 points.
That's all folks!!!