Hangman is a word-guessing game that can be played by two people. Player 1 thinks of a single word consisting of N letters, and draws a row of N dashes on a piece of paper. These dashes correspond to the letters of the word, in the same order. Player 2 then attempts to discover the word by making a sequence of letter guesses. For each letter guessed by Player 2:
If the letter occurs one or more times in the word, Player 1 writes the letter above each corresponding dash.
If the letter does not occur in the word, Player 1 adds one component to a drawing of a stick-figure man hanging on a gallows. The drawing (initially empty) has 10 possible components: base, vertical beam, horizontal beam, rope, head, torso, right leg, left leg, right arm, left arm.
If Player 2 guesses all the letters in the word before the drawing of the hanging man is complete, then Player 2 wins (and Player 1 loses). Otherwise, Player 2 loses (and Player 1 wins).
When the game starts, Player 1 will input a word. Then, Player 2 will guess the word. Since we don't want Player 2 to see the word input by Player 1, you will "clear" the screen by outputting 25 blank lines AFTER Player 1 enters a word. Now, you will ask Player 2 for a letter until either Player 2 guesses all of the correct letters or Player 2 guesses 10 incorrect letters.
NOTE: Capitalization will NOT be enforced for words (e.g. your program must match h with H or vice-versa).
At the end of the game, print out who won the game--either Player 1 or Player 2. Then, ask if the user wants to play the game again.
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here