The goal of this homework assignment is to create a simple version of Hangman.
This assignment is due at 11:59pm. on the date listed on the course website's calendar.
This is a single-player game.
The player specifies the length of the word they'd like the use, and the computer picks a random word from a list that is the appropriate length. The player then guesses a letter that they think may appear in the word. The computer checks whether the letter appears in the word and either reveals all instances of it (if it exists) or takes away one point from the player's lives. The computer then displays (somehow) the progress that the player has made towards guessing the word. The game continues until either all of the letters have been guessed (and the player wins) or all of the player's lives are used up (and the player loses). In either case, the computer should announce this event and the game should end.
Here is an example dialog. Words in parentheses are provided for clarity and do not need to show up in your actual output:
Computer asks: "How long of a word do you want to play with?"
Human says 8.
(computer picks the word "fireball")
Computer: _ _ _ _ _ _ _ _
Human: r
Computer: _ _ r _ _ _ _ _
Human: a
Computer: _ _ r _ _ a _ _
Human: L
Computer: _ _ r _ _ a l l
Human: h
Computer: _ _ r _ _ a l l
Human: f
Computer: f _ r _ _ a l l
Human: e
Computer: f _ r e _ a l l
Human: i
Computer: f i r e _ a l l
Human: b
Computer: f i r e b a l l
Computer says "Congratulations! You figured out my word in 9 guesses and had 3 lives left!"
We have provided a starter file for HW2 which includes a word bank of 1000 words. Click here to open the project in snap.
* What do you think should happen if the computer doesn't know any words that are the length of the one specified by the user?
* What do you think should happen if the player guesses a letter that they've already guessed?
* You can let the player start with any number of lives.
* We highly recommend you include comments in your code (by right clicking on the background and clicking add coment). Adding comments will help yourself, the graders, and others (such as your project partner for HW3 which builds off HW2) be able to decipher your code.
Give your program the capability to print the words on the screen using sprites. Snap includes several sets of letters that can be used as costumes for your sprites in the Letters
directory. Try to make it so that the word that's being printed is always centered, regardless of the length. You should be able to account for words up to (and including) 11 letters long.