aspose file tools*
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 Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Hangman BufferReader ??" Watch "Hangman BufferReader ??" New topic
Author

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
Greenhorn

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
Greenhorn

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: http://aspose.com/file-tools
 
subject: Hangman BufferReader ??