Inspired by reddit.
Write a program which plays Hangman.
- The program chooses a random word from a list of N words, where N > 2.
- The word list can be provided to the program in any way you choose.
At each iteration
- Print out the state of the game using underscores for letters not yet discovered:
H _ N _ _ _ N
- Print the number of remaining attempts
- Read a letter from stdin, and update the state of the game, subtracting an attempt if they guess an incorrect letter.
H A N _ _ A N
- Repeat until all letters are guessed or attempts reaches 0
- Use any language
- Fewest number of characters wins.
- Drawing the gallows is not necessary, but will earn you upvotes and kudos.