Assignment 5 - The Easy Dice Game

due October 28th

The purpose of this assignment is to give you practice using loop statements, if ... and if ... else statements, practice writing functions, and program planning and development.

You are to write a dice game for one player (the computer). The rules for the game are:

  1. The game ends when the player gets 100 or more points after the turn.
  2. The player take turns and each turn may consist of one to 3 rolls of the dice.
  3. The turn ends after 3 rolls or if the user rolls a 7 as the sum of the two dice.
  4. The player earns the sum of all rolls taken during his/her turn. These points are added to the player's cumulative total points.
  5. The points for a roll is the sum of both dice, unless 7 is rolled.  For a 7, the roll is counted as 0 points and the turn ends.  The player still get the points rolled before the 7 is rolled.

Program requirements

  1. Your output should look quite "similar" to that shown below, including the results of each roll, totals for each turn, and cumulative total for the turns.
  2. Your program should contain a double loop.

Additional comments

It is important that you break the program down into smaller parts, so your planning is quite important.  Study the sample output below to make sure you understand the logic of the game.


Sample output



This is your turn #1
* You rolled 6 and 6.  That's 12
* You rolled 5 and 5.  That's 10
* You rolled 6 and 5.  That's 11
** You scored 33 points for this turn
*** Your total is now 33

This is your turn #2
* You rolled 1 and 1.  That's 2
* You rolled 5 and 3.  That's 8
* You rolled 6 and 6.  That's 12
** You scored 22 points for this turn
*** Your total is now 55

This is your turn #3
* You rolled 2 and 4.  That's 6
* You rolled 2 and 6.  That's 8
* You rolled 2 and 3.  That's 5
** You scored 19 points for this turn
*** Your total is now 74

This is your turn #4
* You rolled 4 and 1.  That's 5
* You rolled 4 and 1.  That's 5
* You rolled 3 and 4.  That's 0
** You scored 10 points for this turn
*** Your total is now 84

This is your turn #5
* You rolled 5 and 5.  That's 10
* You rolled 4 and 3.  That's 0
** You scored 10 points for this turn
*** Your total is now 94

This is your turn #6
* You rolled 3 and 6.  That's 9
* You rolled 6 and 1.  That's 0
** You scored 9 points for this turn
*** Your total is now 103