|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.rice.comp440.move.Move
Class which represents a move in backgammon. Clients can either build specific moves themselves, possibly from human input, or use the movement factory to build moves. Moves are constructed by adding a number of movements until all of the dice have been used or no more moves are possible. When evalutaing a move, a client can use the move.getCurrentBoard() method, which will return the state of the board after the move.
Field Summary | |
protected Board |
board
|
protected Board[] |
boards
|
protected Dice |
dice
|
protected Movement[] |
movements
|
protected int |
player
|
protected int[] |
used
|
static int |
USED
|
Constructor Summary | |
Move(Dice dice,
Board board,
int player)
Builds a new Move, using the provided dice roll |
|
Move(Move move)
Clones the given move |
Method Summary | |
void |
addMovement(Movement movement)
Adds a movement to this move. |
boolean |
equals(java.lang.Object other)
Returns whether or not this move is equal to the other |
Board |
getCurrentBoard()
Returns the current scratch board, or the board with all internmediate movements applied |
protected int |
getNumMovements()
Returns the number of movements currently in this move |
Board |
getOriginalBoard()
Returns the starting board of the move |
int |
hashCode()
Returns the hashCode of this move |
boolean |
isFull()
Returns whether or not there are move moves to be made |
boolean |
movePossible()
Returns whether or not a move is possible for the current user. |
java.lang.String |
toString()
Returns a String representation of this move |
Methods inherited from class java.lang.Object |
clone,
finalize,
getClass,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
public static int USED
protected Dice dice
protected Movement[] movements
protected int[] used
protected Board board
protected Board[] boards
protected int player
Constructor Detail |
public Move(Dice dice, Board board, int player)
dice
- The dice rollpublic Move(Move move)
move
- The move to cloneMethod Detail |
public boolean movePossible()
player
- The current playerpublic void addMovement(Movement movement) throws IllegalMoveException
movement
- The movement ot addpublic Board getCurrentBoard()
public Board getOriginalBoard()
public boolean isFull()
protected int getNumMovements()
public int hashCode()
public boolean equals(java.lang.Object other)
other
- TO come topublic java.lang.String toString()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |