subject

The purpose of this assignment is to practice with ArrayLists (and hopefully, you'll have some fun). As far as the user knows, play is exactly as it would be for a normal game of hangman, but behind the scenes, the computer cheats by delaying settling on a mystery word for as long as possible, which forces the user to use up several (perhaps all) chances.

initialization:

The program reads a list of possible dictionary words, but instead of choosing one, it only decides on the length of a mystery word, which you might call randLength, a value chosen at random within some interval RAND_MIN and RAND_MAX, which are constants that you define in your program. Instead of choosing a word of randLength, the program removes all words from the list that are not of this length. That is, instead of choosing a word of length randLength, it keeps a list of all the words from the dictionary that are randLength letters long.

cheat phase:

During this phase of the game, the program delays choosing a real random word for as long as possible. As in a normal game of hangman, the user may during any given round make a guess which is a full word, or a single letter. If the user guesses a word, and that word appears in our list of possible words, it is removed. If the guess is a single letter, every word remaining in the list that contains the letter is removed. The purpose of the cheat is to force the player to eat through as many chances as possible, increasing the chances that the player loses.

Obviously, at some point this phase must end. Otherwise, the user will realize that the cheat has taken place. This phase is ended if either of two conditions is true:

The user has run out of guesses. In this case, the program prints a message telling the user that they've lost. It chooses some word at random from the remaining words in the list, and tells the user that this was the mystery word all along.
The computer can't cheat any more. If the user makes a guess, and removing a word or words as we've specified previously would result in an empty list, the computer would get caught cheating. Your program must ensure that this never happens. Instead of removing the words from the list, the program should settle on a mystery word, by choosing it at random from the list of remaining words, and play continues as it would have during a normal game of hangman.
non-cheat phase

Play continues just as it would have during a normal game of hangman, except of course, because of the cheats, the user has fewer chances remaining.

the dictionary

You may use this small dictionary (dic. txt).

be stealthy

Remember that the cheating is done behind the scenes. To the user, the program should look like a normal game of hangman.

ArrayList

During each round of the cheat phase, you'll be manipulating a collection of words and you won't know in advance how much the size will change as the game progresses. At the beginning of the program, you'll have a large number of words, but you won't know how large. At each stage, it'll be reduced, but you won't know how much. While this is possible with an array, it's clear that ArrayList, which can grow and shrink as needed, is more appropriate.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 24.06.2019 07:00
Guys do you know sh27 cause he hacked me : ( pidgegunderson my old user
Answers: 2
question
Computers and Technology, 24.06.2019 14:00
Fast answer i need for apex ! smartphones should be banned from the classroom in public schools so that students cannot cheat on test so easily? which is an example of a counter argument to the thesis above? a.the classroom is a place for learning not for making phone calls b. smartphones are useful learning tools in the modern classroom c.banning smartphones will not students pay attention to teachers any better d. banning smartphones would decreased incidents of theft
Answers: 2
question
Computers and Technology, 24.06.2019 16:00
Your is an example of personal information that you should keep private.
Answers: 2
question
Computers and Technology, 25.06.2019 04:00
Use the wrap text icon to modify which graphic appears in the front of layered images modify the picture effects change the way text is wrapped around an object apply wordart to the text
Answers: 1
You know the right answer?
The purpose of this assignment is to practice with ArrayLists (and hopefully, you'll have some fun)....
Questions
question
Mathematics, 19.11.2020 04:20
question
Mathematics, 19.11.2020 04:20
question
Mathematics, 19.11.2020 04:20