Assignment 8 - The Dice
Game Revisited
due Monday, November 18th
The purpose of this
assignment is to give you
practice writing
functions and problem analysis.
This assignment is largely
a repeat of assignment 6.
The rules have
changed. There are more details and some problem
analysis involved.
The Game Rules
There are again 3
players with different personalites:
- Larry is a "chicken". He will only roll one time
for his turn.
- Curly is a little more daring. He will attempt to
roll three times during his turn.
- Moe is is "wild and crazy". He will attempt to
keep rolling until he wins or a 1 is rolled, ending the turn.
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. Make sure
Larry goes first, Curly is second, and Moe is third.
The turn ends either
voluntarily or if the user rolls a 1 on either or
both dice.
The player earns the sum
of all rolls taken during his/her
turn
unless a 1 is rolled. These points are
added to the player's cumulative total points.
If the player rolls one
1, points for the turn is 0, and the turn ends.
If the player rolls two
1s, points for the turn is 0, total points
for
the player is reset to 0, and the turn ends.
Program requirements
- Your program must contain at least 4 functions (counting
main()). Include a function that contains a reference argument,
and a function
that contains a default
argument. Place the function definitions below
main() and function prototypes above main().
- Your program output should very similar
to
the sample
output below.
- Do not use
global variables, except global constants.
- Your code will be tested for the expected results
and for your
handling of a "skunk".
Sample Game Output
Larry, its your turn
You rolled 3 and 1. That's 0
That's 0 points for your turn
Total points = 0
Curly, its your turn
You rolled 5 and 3. That's 8
You rolled 5 and 6. That's 11
You rolled 5 and 4. That's 9
That's 28 points for your turn
Total points = 28
Moe, its your turn
You rolled 1 and 5. That's 0
That's 0 points for your turn
Total points = 0
Larry, its your turn
You rolled 1 and 5. That's 0
That's 0 points for your turn
Total points = 0
Curly, its your turn
You rolled 6 and 3. That's 9
You rolled 3 and 3. That's 6
You rolled 5 and 2. That's 7
That's 22 points for your turn
Total points = 50
Moe, its your turn
You rolled 1 and 3. That's 0
That's 0 points for your turn
Total points = 0
Larry, its your turn
You rolled 3 and 1. That's 0
That's 0 points for your turn
Total points = 0
Curly, its your turn
You rolled 5 and 5. That's 10
You rolled 5 and 2. That's 7
You rolled 2 and 3. That's 5
That's 22 points for your turn
Total points = 72
Moe, its your turn
You rolled 6 and 4. That's 10
You rolled 6 and 3. That's 9
You rolled 1 and 2. That's 0
That's 0 points for your turn
Total points = 0
Larry, its your turn
You rolled 2 and 4. That's 6
That's 6 points for your turn
Total points = 6
Curly, its your turn
You rolled 2 and 6. That's 8
You rolled 2 and 2. That's 4
You rolled 6 and 4. That's 10
That's 22 points for your turn
Total points = 94
Moe, its your turn
You rolled 5 and 5. That's 10
You rolled 6 and 3. That's 9
You rolled 6 and 5. That's 11
You rolled 2 and 1. That's 0
That's 0 points for your turn
Total points = 0
Larry, its your turn
You rolled 1 and 4. That's 0
That's 0 points for your turn
Total points = 6
Curly, its your turn
You rolled 1 and 1. That's SKUNK
That's 0 points for your turn
Total points = 0
Moe, its your turn
You rolled 5 and 3. That's 8
You rolled 6 and 4. That's 10
You rolled 5 and 1. That's 0
That's 0 points for your turn
Total points = 0
Larry, its your turn
You rolled 1 and 5. That's 0
That's 0 points for your turn
Total points = 6
Curly, its your turn
You rolled 1 and 2. That's 0
That's 0 points for your turn
Total points = 0
Moe, its your turn
You rolled 6 and 4. That's 10
You rolled 1 and 5. That's 0
That's 0 points for your turn
Total points = 0
Larry, its your turn
You rolled 5 and 1. That's 0
That's 0 points for your turn
Total points = 6
Curly, its your turn
You rolled 6 and 3. That's 9
You rolled 3 and 5. That's 8
You rolled 5 and 2. That's 7
That's 24 points for your turn
Total points = 24
Moe, its your turn
You rolled 6 and 3. That's 9
You rolled 2 and 1. That's 0
That's 0 points for your turn
Total points = 0
Larry, its your turn
You rolled 1 and 4. That's 0
That's 0 points for your turn
Total points = 6
Curly, its your turn
You rolled 5 and 6. That's 11
You rolled 6 and 4. That's 10
You rolled 2 and 2. That's 4
That's 25 points for your turn
Total points = 49
Moe, its your turn
You rolled 2 and 5. That's 7
You rolled 6 and 1. That's 0
That's 0 points for your turn
Total points = 0
Larry, its your turn
You rolled 3 and 5. That's 8
That's 8 points for your turn
Total points = 14
Curly, its your turn
You rolled 2 and 4. That's 6
You rolled 5 and 1. That's 0
That's 0 points for your turn
Total points = 49
Moe, its your turn
You rolled 2 and 1. That's 0
That's 0 points for your turn
Total points = 0
Larry, its your turn
You rolled 3 and 1. That's 0
That's 0 points for your turn
Total points = 14
Curly, its your turn
You rolled 3 and 4. That's 7
You rolled 2 and 4. That's 6
You rolled 6 and 3. That's 9
That's 22 points for your turn
Total points = 71
Moe, its your turn
You rolled 3 and 1. That's 0
That's 0 points for your turn
Total points = 0
Larry, its your turn
You rolled 1 and 2. That's 0
That's 0 points for your turn
Total points = 14
Curly, its your turn
You rolled 4 and 1. That's 0
That's 0 points for your turn
Total points = 71
Moe, its your turn
You rolled 5 and 6. That's 11
You rolled 1 and 4. That's 0
That's 0 points for your turn
Total points = 0
Larry, its your turn
You rolled 3 and 4. That's 7
That's 7 points for your turn
Total points = 21
Curly, its your turn
You rolled 4 and 3. That's 7
You rolled 4 and 3. That's 7
You rolled 5 and 4. That's 9
That's 23 points for your turn
Total points = 94
Moe, its your turn
You rolled 1 and 4. That's 0
That's 0 points for your turn
Total points = 0
Larry, its your turn
You rolled 5 and 5. That's 10
That's 10 points for your turn
Total points = 31
Curly, its your turn
You rolled 3 and 1. That's 0
That's 0 points for your turn
Total points = 94
Moe, its your turn
You rolled 4 and 6. That's 10
You rolled 4 and 6. That's 10
You rolled 1 and 3. That's 0
That's 0 points for your turn
Total points = 0
Larry, its your turn
You rolled 1 and 1. That's SKUNK
That's 0 points for your turn
Total points = 0
Curly, its your turn
You rolled 2 and 3. That's 5
You rolled 1 and 6. That's 0
That's 0 points for your turn
Total points = 94
Moe, its your turn
You rolled 2 and 6. That's 8
You rolled 1 and 1. That's SKUNK
That's 0 points for your turn
Total points = 0
Larry, its your turn
You rolled 1 and 1. That's SKUNK
That's 0 points for your turn
Total points = 0
Curly, its your turn
You rolled 6 and 4. That's 10
That's 10 points for your turn
Curly won the game with 104 points