subject

Description:
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 anymore. 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:
Use "dic. txt" as a dictionary.

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.

dic. txt

account
acid
across
angry
animal
answer
ant
any
apparatus
apple
approval
arch
awake
baby
back
bad
bitter
black
blade
blood
blow
blue
chief
chin
church
circle
clean
clear
clock
condition
existence
expansion
fowl
frame
free
frequent
friend
from
front
fruit
full
future
garden
general
get
girl
give
glass
glove
go
goat
gold
good
hat
hate
have
he
head
healthy
hearing
heart
how
ice
idea
if
ill
important
impulse
in
interest
invention
iron
island
jell
journey
nation
needle
nerve

ansver
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 15:10, AleciaCassidy
Consider a direct-mapped cache with 216 words in main memory. the cache has 16 blocks of 8 words each. it is a word-addressable computer (rather than a byte-addressable computer which we normally discuss). (a) how many blocks of main memory are there? (b) what is the format of a memory address as seen by the cache, that is, what are the sizes of the tag, cache block, and block offset fields (if they apply)? (c) to which cache block will the memory reference db6316 map?
Answers: 1
image
Computers and Technology, 22.06.2019 22:30, juliangarcia0002
Which of the following factors would your hypothetical supervisor look at when deciding whether to test a biological material sample for dna? the amount of other evidence you have implicating a suspect in a crime the annual budget for the crime lab both of the above none of the above; you would almost always order a test
Answers: 3
image
Computers and Technology, 23.06.2019 01:50, jumoke26
Create a class named majors that includes an enumeration for the six majors offered by a college as follows: acc, chem, cis, eng, his, phys. display the enumeration values for the user, then prompt the user to enter a major. display the college division in which the major falls. acc and cis are in the business division, chem and phys are in the science division, and eng and his are in the humanities division. save the file as majors. java.
Answers: 2
image
Computers and Technology, 23.06.2019 23:30, issacurlyheadka
A. in packet tracer, only the server-pt device can act as a server. desktop or laptop pcs cannot act as a server. based on your studies so far, explain the client-server model.
Answers: 2
You know the right answer?
Description:
The purpose of this assignment is to practice with ArrayLists (and hopefully, you...

Questions in other subjects:

Konu
Mathematics, 02.01.2020 15:31
Konu
Mathematics, 02.01.2020 15:31
Konu
Biology, 02.01.2020 15:31