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:
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
its own cootie according to the rules of the game. The human
roll the die and enter the value to the computer. The computer
which part to add (if any) and displays the drawing. The human
his or her own cootie. The computer should be able to detect
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.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 = body3.4 If no part can be added (according to the rules), display a message.
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.
5.0 USER INTERFACE
5.1 The interface will be a simple
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."
Remember, your program will be tested on Unix1. Code that
does not compile will receive a grade of zero.
You need to submit your source code electronically using the
handin utility: No late submittals will be accepted!
handin graderjd Project3 cooties.c