Class Jump

java.lang.Object
  |
  +--Jump

public class Jump
extends java.lang.Object

This class defines what a jump is and provides methods for obtaining jumps. A jump is a LinkedList of Integers. The first element in the list is the starting position of the piece, the other elements are the positions on the board where the piece lands after jumping over an opponent's piece.


Constructor Summary
Jump()
           
 
Method Summary
static boolean CanJump(CheckerBoard b, int pos)
          Given a CheckerBoard and a position on the board, returns true if the piece at position pos can make a jump, false otherwise.
static java.util.LinkedList GetJumps(CheckerBoard b, char player)
          Given a CheckerBoard and a player, returns a LinkedList containing all jumps that the player can make.
static java.util.LinkedList GetJumps(CheckerBoard b, int p)
          Given a CheckerBoard and a position on the board, returns a LinkedList all possible jumps the piece at the position can make.
static CheckerBoard MakeJump(CheckerBoard b, java.util.LinkedList jump)
          Given a CheckerBoard and a jump, returns a new CheckerBoard after the jump has been taken.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Jump

public Jump()
Method Detail

GetJumps

public static java.util.LinkedList GetJumps(CheckerBoard b,
                                            char player)
Given a CheckerBoard and a player, returns a LinkedList containing all jumps that the player can make. Note that player must be 'p','P', 'o', or 'O'.


GetJumps

public static java.util.LinkedList GetJumps(CheckerBoard b,
                                            int p)
Given a CheckerBoard and a position on the board, returns a LinkedList all possible jumps the piece at the position can make.


CanJump

public static boolean CanJump(CheckerBoard b,
                              int pos)
Given a CheckerBoard and a position on the board, returns true if the piece at position pos can make a jump, false otherwise.


MakeJump

public static CheckerBoard MakeJump(CheckerBoard b,
                                    java.util.LinkedList jump)
Given a CheckerBoard and a jump, returns a new CheckerBoard after the jump has been taken.