Program that, if the guess is wrong, shows the user how many letters match the hidden word and how many of those letters are in the correct place.
Each turn the player will guess a word. If the guess is correct, the computer will report how many guesses it has made and the program will terminate. If the guess is wrong, the computer will tell you how many letters match the hidden word and the guess, and how many of those letters are in the correct spot. The player will then make the next guess. If the user enters the hint code 'xxxxx' (hint word: secret word) the program displays the secret word. Using the hint code count as a guess and not terminate the program.
This program is coded using two classes.
The class named Dictionary is used to
- perform search functions for words to enter and store words,
- pick a random word from the list,
- verify that they are in the dictionary.
The other class named Words is used to
- pay attention to the game rules,
- monitor the game status,
- manage user login and logout.