public class Game extends Object implements IClusterable
| Constructor and Description |
|---|
Game() |
| Modifier and Type | Method and Description |
|---|---|
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.
|
public int getGuessesRemaining()
public Word getWord()
public boolean guess(Letter letter)
letter - The letter being guessedpublic boolean isLost()
public boolean isWon()
public void newGame()
public void newGame(int guessesAllowed,
WordGenerator wordGenerator)
guessesAllowed - Number of guesses allowedwordGenerator - The word generatorCopyright © 2020. All rights reserved.