• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Hangman BufferReader ??

 
Ranch Hand
Posts: 230
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
reply
    Bookmark Topic Watch Topic
  • New Topic