java HangmanApp
Usage: java HangmanApp [ui class] [-t] [ui class] is name of user interface class (default is 'SimpleUI'). [-t] optional flag to turn on test mode (for developers'). Uses wordlist as word source. Welcome to Hangman! _ _ _ _ _ _ _ _ _ _ _ _ Guesses: 0
java HangmanApp SimpleUI
Welcome to Hangman!
_ _ _ _ _
Guesses: 0
Enter move: e
_ E _ _ E
Guesses: 0
Enter move: s
_ E _ _ E
Guesses: 1
Enter move: r
_ E _ _ E
Guesses: 2
Enter move: n
_ E _ _ E
Guesses: 3
Enter move: t
_ E _ _ E
Guesses: 4
Enter move: l
_ E _ _ E
Guesses: 5
Enter move: o
_ E _ _ E
Guesses: 6
Enter move: a
_ E A _ E
Guesses: 6
Enter move: x
_ E A _ E
Guesses: 7
You have Lost!
The word was: PEACE
Play Again?
y
In the example game below, the user guesses the word and wins the game.
_ _ _ _ _ _ _
Guesses: 0
Enter move: e
_ _ E _ _ _ _
Guesses: 0
Enter move: a
_ _ E _ _ A _
Guesses: 0
Enter move: o
_ _ E _ _ A _
Guesses: 1
Enter move: i
_ _ E _ I A _
Guesses: 1
Enter move: l
_ _ E _ I A L
Guesses: 1
Enter move: s
S _ E _ I A L
Guesses: 1
Enter move: p
S P E _ I A L
Guesses: 1
Enter move: c
S P E C I A L
Guesses: 1
You have Won!
Play Again?
n
In the example below a player guesses an invalid letter.
Welcome to Hangman!
_ _ _ _ _ _ _ _ _ _ _
Guesses: 0
Enter move: 2
Error: Invalid move
Enter move: a
_ _ _ A _ _ A _ _ _ _
Guesses: 0
Enter move:
java HangmanApp SwingUI
When the application begins, a window appears displaying the game board. The title bar may be customized for your team.
During play, the player uses the mouse or keyboard to select buttons
for the letter they want to guess. Guessed letter buttons are greyed out
(disabled) and correctly guessed letters are placed in their proper position.
In the example below, the user has guessed letters A and C correctly so
they appear in the word display in the position they belong in the hidden
word. The letter X was guessed and it is NOT in the hidden word so
the guess counter is incremented to one. All three letters A, C,
and X are greyed out. Note that the guess counter is not incremented
for correctly guessed letters.
In the example below, the user has used all seven guesses so they lost
the game.
In the example below, the player correctly guessed all the letters in
the word, so they won the game.
The picture below shows the Play Again dialog which appears when the
game is over. Note that the buttons have keyboard shortcuts and that
the default button is Yes.
_________
|
|
|
|
|
|
|
---
_ _ _ _ _ _ _
Possible moves:
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Enter move: p
_________
|
|
|
|
|
|
|
---
_ P _ _ _ _ _
Possible moves:
A B C D E F G H I J K L M N O Q R S T U V W X Y Z
Enter move: o
_________
|
|
O
|
|
|
|
|
---
_ P _ _ _ _ _
Possible moves:
A B C D E F G H I J K L M N Q R S T U V W X Y Z
Enter move:
You have Lost!
_________
|
|
O
|
\|/
|
|
|
/ \
|
|
---
The word was: SPECIAL
Play Again?