Class aMove

java.lang.Object
  |
  +--aMove

public class aMove
extends java.lang.Object

This class defines what a move is and provides methods for generating moves for a player or for a piece. There are two fields, both ints, start and end. start is the number of position of the piece before the move is made, while end is the number of the position where the piece ends up after making the move.


Constructor Summary
aMove()
          The start and end are both initialized to -1.
aMove(int i, int j)
          Start is set to be i, and end is set to be j.
 
Method Summary
 int GetEnd()
          Returns end
static java.util.LinkedList GetMoves(CheckerBoard b, char c)
          Given a CheckerBoard and a player, returns a LinkedList of aMoves that includes all legal moves (but no jumps) that the player can make.
static java.util.LinkedList GetMoves(CheckerBoard b, int pos)
          Given a checkerboard and an int specifying a board position, returns a LinkedList of all possible moves (but no jumps) that can be made by the piece in that position.
 int GetStart()
          Returns start
static CheckerBoard MakeMove(CheckerBoard b, aMove m)
          Given a CheckerBoard and an aMove, returns a new CheckerBoard where the move has been executed.
 void Set(int i, int j)
          Start is set to be i, and end is set to be j.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

aMove

public aMove()
The start and end are both initialized to -1. This is an ileagal move.


aMove

public aMove(int i,
             int j)
Start is set to be i, and end is set to be j. There is no checking as to whether this move is legal.

Method Detail

Set

public void Set(int i,
                int j)
Start is set to be i, and end is set to be j. There is no checking as to whether this move is legal.


GetStart

public int GetStart()
Returns start


GetEnd

public int GetEnd()
Returns end


GetMoves

public static java.util.LinkedList GetMoves(CheckerBoard b,
                                            char c)
Given a CheckerBoard and a player, returns a LinkedList of aMoves that includes all legal moves (but no jumps) that the player can make.


GetMoves

public static java.util.LinkedList GetMoves(CheckerBoard b,
                                            int pos)
Given a checkerboard and an int specifying a board position, returns a LinkedList of all possible moves (but no jumps) that can be made by the piece in that position.


MakeMove

public static CheckerBoard MakeMove(CheckerBoard b,
                                    aMove m)
Given a CheckerBoard and an aMove, returns a new CheckerBoard where the move has been executed.