|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectknockabout.gamemodel.GameState
The state of a knockabout game
Constructor Summary | |
GameState()
|
Method Summary | |
void |
applyCompiledMove(CompiledMove move)
Apply a compiled move to the state Note: there is no check if this compiled move is valid for this state, it will throw a NullPointerException if it is not the case TODO: throw a more intelligent RunTimeException... |
CompiledMove |
applyMove(Move move)
Applies the supplied game move by player color 'playercolor' on the game board. |
GameState |
deepClone()
Perform a deep clone, including a fresh copy of all the enclosing objects |
Board |
getBoardPosition()
|
Die |
getDieToRoll()
If the previous move applied involved the roll of a dice, the dice to roll is left unchanged, BUT this field is updated so it is the responsability of the player to reroll it/update it |
int |
getMaxColor()
See class Player |
int |
getMinColor()
|
float |
getUtility()
Evaluate the utility of this knockabout state, 1 if the player of color maxColor wins, -1 if maxColor player loses, 0 otherwise |
java.util.List |
possibleMoves(int playerColor)
Enumerate all valid move for a given player |
void |
setBoardPosition(Board board)
|
void |
setDieToRoll(Die die)
|
void |
setMaxColor(int i)
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public GameState()
Method Detail |
public java.util.List possibleMoves(int playerColor)
playerColor
- The color of the given player (see class Player)
public float getUtility()
public void applyCompiledMove(CompiledMove move)
move
- The compiled movepublic CompiledMove applyMove(Move move)
move
- The Move to execute on this state
public Board getBoardPosition()
public Die getDieToRoll()
public int getMaxColor()
public void setBoardPosition(Board board)
board
- public void setDieToRoll(Die die)
die
- public void setMaxColor(int i)
i
- public int getMinColor()
public GameState deepClone()
public java.lang.String toString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |