The Hangman Game
This version of the game will have the following requirements: Create a menu for
the user to choose from, similar to the following:
1. Play a game
2. Display statistics
3. Quit
The following actions should take place based on the menu. If the user chooses:
1. Play the game: Ask for the player's (user's) name and store it. The
computer randomly chooses a secret word from 10 words available and
stored in a 2D array of characters. Assume 30 characters as a fixed maximum
length of each word. Display underscores to the player depending on the
number of letters the chosen word has. Say the word chosen was mystery.
You need to display 7 underscores: ______. Ask the player to guess a
letter. Check if the letter is included in the secret word and display. Ex. if the
user chooses y, then you should display y_y__. The player has 10 tries
to correctly find the word. Moreover, you need to change the player's score
depending on the following criteria:
Criteria Points
Letter found 10
Letter not found -2
Word found 100
Word not found -40
Note: If the player chooses a letter which he/she has already chosen before, display
a message and let the user try again without changing the points earned so far, nor
decrementing his total tries.
The game ends when the player has found the word or when all the available tries
are used up. Once the game ends, display the player's name and score.
Afterwards go back and display the initial menu.
2. Do nothing for now.
3. Quit the game.
You will need to demonstrate arrays, loops, if-else and switch/case statements and
use of functions (and passing arrays to functions) in this program. No global
variables are allowed! You can use the following naming convention (or anything
you choose, but you need to stick to it!): camel casing for variable names, Pascal
casing for functions and all capital for constants. Do not forget to comment your
code where necessary. The minimum is a function header for each function and a
program header to explain what your program does.. You should handle the case
where the user enters anything different than 1, 2 or 3, in the menu though.