edu.rice.comp440.move
Class BarMovement

java.lang.Object
  |
  +--edu.rice.comp440.move.Movement
        |
        +--edu.rice.comp440.move.BarMovement

public class BarMovement
extends Movement


Field Summary
protected  int end
           
 
Fields inherited from class edu.rice.comp440.move.Movement
player
 
Constructor Summary
BarMovement(int player, int end)
          Constructor, taking the player and the end 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 getEnd()
          Returns the end 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 edu.rice.comp440.move.Movement
getPlayer
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

end

protected int end
Constructor Detail

BarMovement

public BarMovement(int player,
                   int end)
Constructor, taking the player and the end location
Parameters:
player - The player making the movement
start - The start location
end - The end location
Method Detail

getEnd

public int getEnd()
Returns the end location movement
Returns:
The end location for this movement

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

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 roll
player - The player
board - The board
Returns:
Wether or not a move is possible

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