This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Hangman BufferReader ?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Hangman BufferReader ??" Watch "Hangman BufferReader ??" New topic

Hangman BufferReader ??

Paul Yule
Ranch Hand

Joined: May 12, 2008
Posts: 229
I would probably just check to see if there are any of the replacement letters left in the word. Hmm, I'll give an example.

This is what I would use to fill the word with characters to hide the word. Ignoring spaces because we need to keep spaces in case it's multiple words. So "I heart JR" would appear "- ----- --" Whenever someone made a guess I would check to see if there are any dashes left in the word after theirguess. If not, it's complete. Your solution of not allowing the same letter to be guessed again is nice because it has the added advantage of requiring you to keep all the letters previously guessed which could be cool to show to the user before they guess.
Kris Danielewski

Joined: Apr 01, 2009
Posts: 25
I found resolution I transfered back the user input array into a String and compare it to the hidden word :>
Now if you press letter which hiddenword contains its still increase the counter but you will not win the game and small bit is quite important.
Counter may be greather then or equal.
Kris Danielewski

Joined: Apr 01, 2009
Posts: 25
Hey Guys , thanks for your help
I finally made it work :]
Feel quite good as it was my first application, not completly done by myself, but thanksfully to your advices I found the answers.
I had 3 counters,
int wrong; to store bad guesses
int guessright; to store good ones
int fwronf; to so store multiplications of bad ones...

setting counters to 0; every time do..while loop starts.
I agree. Here's the link:
subject: Hangman BufferReader ??
Similar Threads
Hangman type game
Hangman problem!
Hangman game
Small problem with arrays in Hangman java game
Updating the _ _ _ _ _ in a hangman game?