Assignment #3: Sevens Out

due: due: Tuesday, December 3
You will write a program to play a dice game called Sevens Out. It involves rolling two dice and using the sum of the dice. If you roll a sum of seven the game is over. Otherwise you get the sum of the dice added to your score. If you roll the same number on both dice (this is called rolling doubles) you will get double the score.

Here is an example of playing the game:
2, 1 This roll = 3 Score = 3
3, 2 This roll = 5 Score = 8
3, 2 This roll = 5 Score = 13
5, 5 This roll = 20 Score = 33
4, 1 This roll = 5 Score = 38
6, 4 This roll = 10 Score = 48
2, 2 This roll = 8 Score = 56
4, 1 This roll = 5 Score = 61
4, 4 This roll = 16 Score = 77
2, 6 This roll = 8 Score = 85
1, 1 This roll = 4 Score = 89
5, 3 This roll = 8 Score = 97
3, 1 This roll = 4 Score = 101
2, 2 This roll = 8 Score = 109
1, 3 This roll = 4 Score = 113
6, 1
Your final score was 113

Notice how the program shows what dice were rolled on each turn. It also shows how many points you got on that roll. Notice how you get double the points for doubles (5 and 5 gives 20, 4 and 4 gives 16, 2 and 2 gives 8). It also shows the current score so far in that game (eg. after four rolls the score was 3 + 5 + 5 + 20 = 33). The game continued until they finally rolled a sum of 7 (a 6 and a 1). This is not an interactive game. It just plays until it is over showing you the results of each roll.

 ____	
  18


Rolls 2 dice                  (2)   _____

Shows results of each roll    (2)   _____

Gives running score           (2)   _____

Game ends correctly           (3)   _____

Correct final score           (3)   _____

Comments (Opening, Variable, Inline)   (3)   _____

Process Work                  (3)   _____

This is the basic game. There are many other variations on this program that you can do. When you are finished the basic game you should try these other programs.

Program 3B

This version will allow you to play as many games of Sevens Out as you like. Before the game starts you will ask the user for a target score. You will also ask the user how much money they have. Before each game you will ask the user how much they want to bet. If the score of that game is at or above the target score they win the bet. Add that amount to their money. If it is below the target score they will lose the bet. Subtract that amount from their money. The game ends either when the user runs out of money (don't let them bet more than they have) or enters 0 for the amount to bet.

Program 3C

Ask the user how many games to play. Do not print the rolls from each game but add up the final scores from each game. Print the mean (average) score of all the games. Try to predict what you think is the fairest target score for Program 3B.

Program 3D

Add graphics to the basic game. Draw the dice. You could make the score look like an LED display. Use the following code to pause until the user presses a key after each roll:
var ch: char := getchar 

Only the basic version needs full comments. The other versions just need your name and which version of the program it is. If you complete the other versions you will get back any marks you may have lost on the basic version. It is possible to get full marks only doing the basic version (however, if you finish early you will be expected to attempt the other versions to get full value on the process marks). Save your files as follows (if your name was Jane Doe):
basic version - JaneDoeA3.t
version 3B - JaneDoeA3B.t
version 3C - JaneDoeA3C.t
version 3D - JaneDoeA3D.t