Title

Wednesday, 4 February 2015

Logic for the game hangman in java


I have a question on how I can approach a situation. I am still fairly new to coding. For my class our teacher is having us make the classic game of hangman, and I am stuck on a situation. I am just curious to see if anyone can help me get the logic down for this situation.

The problem I am having is this:

 The secret word is: hangman   Your progress: -------   Wrong guesses:   Guesses remaining: 10   Number of words possible: 7359   Guess a letter: e  

How would you go about finding the number of possible words remaining? We are given a dictionary that we read in and get the number of words from that. Can pretty much use anything to solve it. The problem is every time you guess a character correct the list will shrink like this:

 The secret word is: hangman   Your progress: -an--an   Wrong guesses: eix   Guesses remaining: 7   Number of words possible: 3   Guess a letter: g  

Just hope you guys can give me some ideas!

Thanks!

Answer

No comments:

Post a Comment