This week's book giveaway is in the Java in General forum.
We're giving away four copies of Event Streams in Action and have Alexander Dean & Valentin Crettaz on-line!
See this thread for details.
Win a copy of Event Streams in Action this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Hangman BufferReader ??

 
Ranch Hand
Posts: 230
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!