This assignment is worth 0 points.
The figure displayed is as follows:
Incorrect Guess Number | Body Part Added | Symbol |
---|---|---|
1 | Head | 0 |
2 | Left Arm | \ |
3 | Right Arm | / |
4 | Torso | | |
5 | Left Leg | / |
6 | Right Leg | \ |
The final figure, if the suspect loses will be
\0/ | / \For this game, your program will assume the role of the judge, and the user will be the suspect. Since your program can not "think" of a word or phrase, the data will be stored in a file, phrases.txt. The data will be stored one entry per line and can include spaces. This file contains at least one valid data entry. Assume the first word in the file is Hangman.
The judge should begin by presenting the suspect with a picture of the gallows, blanks for each letter in the word, and current conditions, such as the turn, the letters guessed which were incorrect, and other information. The following is an example for the output. Your output need not match exactly, but should be similar.
+--+ | | | | ++++++++ _ _ _ _ _ _ _ Turn: 1 Incorrect Letters: Guess a letter: => E Your guess of E is incorrect. Added Head! +--+ | 0 | | | ++++++++ _ _ _ _ _ _ _ Turn: 2 Incorrect Letters: E Guess a letter: => t Your guess of T is incorrect. Added Left Arm! +--+ | \0 | | | ++++++++ _ _ _ _ _ _ _ Turn: 3 Incorrect Letters: E,T Guess a letter: => A There are 2 of the letter A +--+ | \0 | | | ++++++++ _ A _ _ _ A _ Turn: 3 Incorrect Letters: E,T Guess a letter: =>The program should proceed in this manner until either the suspect figures out the word, or has six incorrect guesses. The player is either pronounced the winner, or given the answer to the puzzle. Finally they are asked to play again, and the process in repeated.
When the player declines to play again, they are given their score (m wins and n losses) and thanked for playing.
-g -O3 -Wall -Wextra -Wuninitialized -pedantic -Wshadow