edu.rice.comp440.move
Class BearOffMovement
java.lang.Object
|
+--edu.rice.comp440.move.Movement
|
+--edu.rice.comp440.move.BearOffMovement
- public class BearOffMovement
- extends Movement
Field Summary |
protected int |
start
|
Constructor Summary |
BearOffMovement(int player,
int start)
Constructor, taking the player, the start location |
Method Summary |
void |
apply(Board board)
Validates this movement given the provided
board situation. |
boolean |
canUse(Board board,
int die)
Returns whether or not this movement can use the given
dice roll to perfrom it's movement |
boolean |
equals(java.lang.Object o)
Returns whether not this movement equals the object |
int |
getStart()
Returns the starting location movement |
static boolean |
movePossible(int die,
int player,
Board board)
Return whether or not a move is possible using
the given dice roll by the given player in the given board. |
java.lang.String |
toString()
Returns a String representation of this move |
Methods inherited from class java.lang.Object |
clone,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
start
protected int start
BearOffMovement
public BearOffMovement(int player,
int start)
- Constructor, taking the player, the start location
- Parameters:
player
- The player making the movementstart
- The start locationend
- The end location
getStart
public int getStart()
- Returns the starting location movement
- Returns:
- The starting location for this movement
movePossible
public static boolean movePossible(int die,
int player,
Board board)
- Return whether or not a move is possible using
the given dice roll by the given player in the given board.
Checks to see if a bar, bear off, or normal movement
are possible.
- Parameters:
int
- die The dice rollplayer
- The playerboard
- The board- Returns:
- Wether or not a move is possible
canUse
public boolean canUse(Board board,
int die)
- Returns whether or not this movement can use the given
dice roll to perfrom it's movement
- Overrides:
- canUse in class Movement
- Parameters:
die
- The dice roll- Returns:
- Wether or not that roll can make this move
apply
public void apply(Board board)
throws IllegalMoveException
- Validates this movement given the provided
board situation.
- Overrides:
- apply in class Movement
- Parameters:
board
- The current setup
equals
public boolean equals(java.lang.Object o)
- Returns whether not this movement equals the object
- Overrides:
- equals in class java.lang.Object
- Returns:
- Whether or not they are equal
toString
public java.lang.String toString()
- Returns a String representation of this move
- Overrides:
- toString in class java.lang.Object
- Returns:
- a String