This program was an assignment of the Object Oriented Design and Analysis Course. The design follows the observer pattern.
Hangman is a simple game where a player attempts to guess a secret word by picking letters from the alphabet.
- Each time the game begins, a random word is chosen from the provided words.txt file
- The chosen/secret word appears as a series of ? (question marks), one for each letter in the secret word.
- A player should try to guess a letter by simply pressing (i.e. typing) the respective key on the keyboard.
- The letter that the player has pressed becomes blue (initially all the letters are light gray).
- One letter key = one guess, unless a player had hit the same key before.
- If the player guesses a letter that occurs in the secret word, all occurrences of that letter will appear, changing from question marks into the correct letter.
- If the player guesses a letter that does not occur in the secret word, the player uses up one guess (the number of remaining guesses is updated), and a portion of the hangman’s body appears.
- If the player correctly guesses all the letters in the secret word before running out of guesses, he/she wins the game.
- If all guesses are used up, the hangman’s entire body appears and the player loses the game.
- The player may start playing again by pressing the New button.
Run src/main/java/edu/neu/ccs/cs5004/assignment11/HangmanGame.java to start the game. When game starts, you may type letters on the keyboard or hit "New" button to restart the game.