Assignment: Hangman Game

Write a hangman program the allows one person to enter a word to be guessed, and then clears the screen. Another person can then guess the word by entering letters. In a text-based program, the output might look similar to:

Enter word to be guessed: BANANA

(Screen clears)
Word is: _ _ _ _ _ _
Your letter ($ to guess word)? S
Sorry, there are no S's.

Your letter ($ to guess word)? N
Word is: _ _ N _ N _

Your letter ($ to guess word)? B
Word is: B _ N _ N _

Your letter ($ to guess word)? S
Sorry, you guessed S already. Try again.

Your letter ($ to guess word)? $

Your guess? BANANA
Correct! You took three tries.

Requirements:

Enhancements:

In traditional hangman, one piece of a stick figure is drawn for each wrong guess. Modify the hangman program to illustrate the traditional 'hangman' near the top of the window. When six wrong guesses are made, the hangman part of the program output should look similar to:

      ---------
      |
      o
     /|\
     / \

You might also have a list of default words. Each game would randomly select a word for the user to guess.

 

Rubric:

Knowledge (16) Level 4 Level 3 Level 2 Level 1
Methods (12) Enhancements to the program. A hangman, etc. Letters already guessed, takes guess, displays winner, displays word with --- in it. Most of level two. Letters already guessed missing. Major problems with game.
Applet (4) Panels, multiple widgets. Outstanding use of design. Something extra. Panels, multiple widgets. Very good design. Colour. Many widgets. Some problems with panels. Major problems with applet or textbased.

 

Applications (6) Level 4 Level 3 Level 2 Level 1
Testing (6) Well formatted. more than 3 words, excellent choices. 3 words tested. Excellent guesses. Tested every line of the program. Some testing done. Problems with write up. Very weak submission or missing.

 

Communication (8) Level 4 Level 3 Level 2 Level 1
Comments (4) Pre/Post or @return /@param are extremely well done. Great comments. Pre/Post or java doc is very well done. Many good comments. Pre/Post or java doc are present. Some comments. Title comments at least. Pre/Post or java doc is extremely weak or missing. Very poor comments.
Methods (4) Program is well decomposed. Nice design of methods. Program has methods. Fairly good design. Program has some methods. Design is weak. Design is really weak.