| java.lang.Object tutorial.numberguess.backend.Game
Game | public class Game (Code) | | The lifecycle of a number guess game is represented by this class.
author: Geert Bevin (gbevin[remove] at uwyn dot com) version: $Revision: 3732 $ |
Constructor Summary | |
public | Game() When a new instance of the class is created, it's regarded as started
a new game. |
Method Summary | |
public int | getAnswer() Retrieves the correct answer. | public long | getDuration() Calculates how much seconds that have elapsed since the start of the
game. | public int | getGuesses() Retrieves the number of guesses that have already been made. | public synchronized void | increaseGuesses() Increases the number of guesses that have been made. |
Game | public Game()(Code) | | When a new instance of the class is created, it's regarded as started
a new game. The answer is randomly generated, the start time is
registered and the number of guesses is initialized to zero.
|
getAnswer | public int getAnswer()(Code) | | Retrieves the correct answer.
An int with the value of the correct answer. |
getDuration | public long getDuration()(Code) | | Calculates how much seconds that have elapsed since the start of the
game.
A long with the number of elapsed seconds. |
getGuesses | public int getGuesses()(Code) | | Retrieves the number of guesses that have already been made.
An int with the number of guesses. |
increaseGuesses | public synchronized void increaseGuesses()(Code) | | Increases the number of guesses that have been made.
|
|
|