Programming Assignment: Cootie Player

OVERVIEW

The children's game of Cootie is played with pencil, paper, and a six sided die. Two players compete to be the first to draw a complete "cootie" which must have a body, a head, two eyes, two antennae, six legs, and a tail:

 
  ! !

 (o o)

- [ ] -

- [ ] -

- [ ] -

   T
 

Each person in turn rolls the die, and depending on the roll, gets to add a body part to their drawing. 1 means the body may be drawn (brackets), 2 means the head may be drawn (parentheses), 3 means a leg may be drawn (dash), 4 means an antenna may be drawn (exclamation point), 5 means an eye may be drawn (letter o), and 6 means the tail may be drawn (letter T). The body must be drawn first; the head must be drawn before eyes or antennae. Whichever player completes their drawing first is the winner.

We want a computer Cootie player that can draw its own cootie according to the rules of the game. The human player must roll the die and enter the value to the computer. The computer then determines which part to add (if any) and displays the drawing. The human has to draw his or her own cootie. The computer should be able to detect when it has completed its drawing and display an appropriate message.
 

1.0 INPUT REQUIREMENTS

1.1 Roll: an integer between 1 and 6, the value of the die roll for the computer's turn.

2.0 OUTPUT REQUIREMENTS

2.1 Prompt for input of roll.
2.2 The Cootie drawing (or partial) using ASCII characters.
2.3 "Can't add a part" message if rules don't allow a move.
2.4 Done message when the drawing is complete.

3.0 FUNCTIONAL REQUIREMENTS

3.1 Start with an empty drawing.
3.2 Display prompt for input of roll.
3.3 Determine if a part can be added to the cootie, depending on the roll:

3.3.1     1 = body
3.3.2     2 = head
3.3.3     3 = one leg
3.3.4     4 = one antenna
3.3.5     5 = one eye
3.3.6     6 = tail
3.3.7     The body must be drawn before any other part (I.e., until a 1 is rolled, no part may be drawn).
3.3.8     The head must be drawn before eyes or antennae.
3.4 If no part can be added (according to the rules), display a message.
3.5 If a part has been added, display the updated cootie drawing.
3.6 Count how many turns are taken.
3.7 Determine if the drawing is complete, i.e., all the parts have been drawn.
3.8 When the drawing is complete, display a message that tells how many turns were taken to finish the cootie, then terminate.

4.0 ERROR HANDLING
4.1 If the input for the roll is greater than 6, display an error message and allow the user to re-enter the value.
4.1 If the input for the roll is less than 1, exit the program.

5.0 USER INTERFACE

5.1 The interface will be a simple scrolling text display using ASCII characters for the drawing, as shown above.
5.2 Input prompt: "Input dice roll: "

5.3 Can't add part message: " Can't add a part."
5.4 Done message:
"Congratulations you have completed your cootie!
 It took you __ turns to finish your cootie."