Question
Create the word game GHOST in Java. Based in the following instructions. At the beginning of the program, read a file words.txt and save the
Create the word game GHOST in Java. Based in the following instructions.
At the beginning of the program, read a file words.txt and save the words into an array. There would be many words in the file. Do not read the file more than once in the program.
Ask for the number of players. Then, begin prompting players to enter a letter, one at a time. In the prompt, show the letters that have been entered so far. After the final player enters a letter, the first player goes again and so on until the game ends.
The game ends when either of two conditions occurs: 1) the letters entered form a word of at least four letters, or 2) the player enters a * to challenge the previous player. If the letters form a word of at least four letters, the last player to enter a letter loses. If a * is entered, check to see if any word begins with the sequence of letters entered so far. If so, the player who entered a * loses. Otherwise, the last player to enter a letter loses. When the game ends, output the loser and end the program.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started