org.jboss.weld.environment.se.example.numberguess
Class Game

java.lang.Object
  extended by org.jboss.weld.environment.se.example.numberguess.Game

@ApplicationScoped
public class Game
extends Object

This class contains the pure logic of the Number Guess game. On initialization a random number will be selected. Multiple "guesses" as to what that number might be can be made using the 'check' method. The user wins if they can guess the selected number in the alloted amount of tries.

Author:
Peter Royle

Field Summary
static int MAX_NUM_GUESSES
           
 
Constructor Summary
Game()
           
 
Method Summary
 boolean check()
           
 int getBiggest()
           
 int getGuess()
           
 int getNumber()
           
 int getRemainingGuesses()
           
 int getSmallest()
           
 boolean isGameLost()
           
 boolean isGameWon()
           
 boolean isValidNumberRange()
           
 void reset()
           
 void setGuess(int guess)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_NUM_GUESSES

public static final int MAX_NUM_GUESSES
See Also:
Constant Field Values
Constructor Detail

Game

public Game()
Method Detail

getNumber

public int getNumber()

getGuess

public int getGuess()

setGuess

public void setGuess(int guess)

getSmallest

public int getSmallest()

getBiggest

public int getBiggest()

getRemainingGuesses

public int getRemainingGuesses()

isValidNumberRange

public boolean isValidNumberRange()

isGameWon

public boolean isGameWon()

isGameLost

public boolean isGameLost()

check

public boolean check()

reset

@PostConstruct
public void reset()


Copyright © 2008-2010 Seam Framework. All Rights Reserved.