Question: Write a program for malicious hangman in java. The program should do: read a text file, dictionary.txt, that contains all words and store these words

Write a program for malicious hangman in java.

The program should do:

read a text file, dictionary.txt, that contains all words and store these words in an appropriate data structure (Note that you have to decide which data structure is better suited for the task).

Prompt the user for a number of letters and a number of guesses for the game.

in order to play a game of Malicious Hangman as follows you must:

Construct a data structure with all the words whose length matches the input length.

Print out dashes for letters remaining to guess along with the number of remaining guesses and any letters the player has guessed already.

Prompt the user for a single letter guess, and only accept letters that they havent guessed yet.

Partition the data structure of words from step (a) into two groups. Group 1 has words containing the guessed letter and group 2 has words NOT containing the letter.

If group 2 is empty then, pick a random word from group 1 and continue playing a normal hangman game.

If group 2 is not empty then group 2 becomes the new data structure in step (a) and the user is informed of their terrible guess.

When player loses, you pick a random word from the set and expose it as the correct word.

When player wins, you display the word with appropriate message.

When the game ends, ask the user if they want to play again and start a new game if the answer is yes.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!