Comp 170
Hangman Lab
Hangman is a classic word game where you guess a secret word
letter by letter. Initially, you know only the number of letters in the word.
Basic Rules
- Entering a word: Get a friend to enter a word for you.
- Guessing
a Letter: Guess a letter by typing it then pressing enter. If you
guess a letter that is in the secret word, the letter will be substituted
everywhere it appears in the word.
- Guessing
Right: If you guess all the letters in the word, you win.
- Guessing
Wrong: Every failed attempt at guessing the word or a letter in the word, draws a part of the Hangman. Once all 6 parts of
the Hangman have been drawn, you lose.
User Interface
- Prompt
the user for a word to guess.
- Get
the word from the user.
- Clear
the screen then display the appropriate number of underscores on the
screen. Be sure to display any
letters that have been guessed correctly.
- Display
the post, rope and appropriate number of body parts for the number of
wrong guesses the user has made.
- Allow
the user to enter a guess letter.
- If the
user still gets more guesses, clear the screen and go back to step 3. Otherwise, draw the complete hangman and
display the word and “Game Over”.
