Ben Kwait

Greenhorn
+ Follow
since Feb 01, 2005
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Ben Kwait

i dont want anyone to do it for me but im having trouble getting all my stuff organized properly. i cant get the Whats your guess to show up after the dashes and i cant get it to where you can input on the first line.
19 years ago
This is a sample input from the directions:
Do you want to play a game? y

I am thinking of a secret word. Try to guess it.

_ _ _ _ _ _ _ _ What's your guess? a
_ _ _ _ _ a _ _ What's your guess? e
_ e _ _ _ _ _ _ What's your guess? i
_ _ _ _ _ _ _ _ What's your guess? o
_ _ _ _ o _ _ _ What's your guess? s
_ _ _ _ _ _ _ _ What's your guess? t
_ _ _ _ _ _ _ _ What's your guess? r
_ _ _ _ _ _ r _ What's your guess? seaboard

"seaboard" is the wrong guess.

_ _ _ _ _ _ _ _ What's your guess? k
k _ _ _ _ _ _ _ What's your guess? keyboard

You've got it in 10 guesses. That was ok!

Do you want to play another game? y

I am thinking of a secret word. Try to guess it.

_ _ _ _ _ What's your guess? a
_ _ _ _ _ What's your guess? e
_ _ _ _ _ What's your guess? i
i _ _ _ _ What's your guess? o
_ _ _ _ _ What's your guess? u
_ _ _ u _ What's your guess? c
_ _ _ _ _ What's your guess? t
_ _ _ _ t What's your guess?

The word is "input".
You gave up after 7 guesses. What happened?

Do you want to play another game? n
Goodbye!

The program repeatedly performs the following actions:

Ask the user if he/she wants to play a game; if the user enters anything but 'y', the program terminates; otherwise

Pick a secret word (see below for how to do that), and print a message to communicate that to the user;

Repeatedly ask the user for a guess:
if the user enters a single letter, show all the places in the secret word where that letter occurs (or an '_' in those places where another letter occurs);
if the user enters a word (more than one letter), check if it is the correct word and, if it is not, print an appropriate message;
if the user just presses the Enter key (i.e., enters an empty string), it means he/she is giving up and you should reveal the secret word and report the number of guesses.

When the user finally guesses the correct word, print a message stating how many guesses were needed, and a message assessing the user's performance according to the following table:

Number of guesses Message
1 That was lucky!
2-4 That was amazing!
5-9 That was really good!
10-14 That was ok!
15-19 That was pretty bad!
20 or more This is not your game!


Go back to the beginning to see if the user wants to play another game.
Picking a secret word
To select a secret word and assign the value to a variable secretWord, you can use the following Java statement:
String secretWord = Words.getWord();

Words.getWord is a function that returns a word randomly picked from those in the words.txt file. Feel free to add your own words to the given words.txt file.

We are using a weird system so just give me the basics of what the code would be please.
19 years ago