|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.wicket.examples.hangman.Game
public class Game
Implementation of the actual hangman game model. The model holds the word generator, the current word, retries remaining and the correctLetters that have been guessed. It also answers questions such as whether all retries have been used.
Constructor Summary | |
---|---|
Game()
|
Method Summary | |
---|---|
int |
getGuessesRemaining()
Return the number of guesses remaining. |
List<Letter> |
getLetters()
|
Word |
getWord()
Get the current word that is being guessed or has been guessed. |
boolean |
guess(Letter letter)
Guess the given letter for the current word. |
boolean |
isLost()
Check whether the user has used up all of their guesses. |
boolean |
isWon()
Check whether the user has successfully guessed all of the correctLetters in the word. |
void |
newGame()
Play another game with same settings |
void |
newGame(int guessesAllowed,
WordGenerator wordGenerator)
Initialise the hangman read for a new game. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Game()
Method Detail |
---|
public int getGuessesRemaining()
public List<Letter> getLetters()
public Word getWord()
public boolean guess(Letter letter)
letter
- The letter being guessed
public boolean isLost()
public boolean isWon()
public void newGame()
public void newGame(int guessesAllowed, WordGenerator wordGenerator)
guessesAllowed
- Number of guesses allowedwordGenerator
- The word generator
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |