rules
Class Move

java.lang.Object
  extended by rules.Move

public final class Move
extends java.lang.Object

Myriad's representation of chess moves, each chess move consists of a starting square an ending square and an appropriate modifier. Once a Move object has been instantiated it cannot be changed!

Author:
Jesse Wang

Field Summary
static Move[] CASTLE
          A constant array storing all special castling moves.
 
Constructor Summary
Move(byte startsq, byte endsq)
          Makes a "normal" move with no special modifier.
Move(byte startsq, byte endsq, byte modifier)
          Makes a special move that requires a start, destination, and a modifier.
 
Method Summary
 byte getEndSquare()
          Gets the ending square of this move object.
 byte getModifier()
          Gets the modifier stored in this move.
 byte getStartSquare()
          Gets the starting square of this move object.
 boolean isEqual(Move m)
          Checks whether another move object is the same as the given move object.
static byte stringTo0x88(java.lang.String sq)
           
static Move toMove(java.lang.String m_s)
           
 java.lang.String toString()
          Returns a string describing this move.
 java.lang.String toString(Position p)
          Converts the move object into expanded algebraic notation.
static java.lang.String x88ToString(byte sq)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CASTLE

public static final Move[] CASTLE
A constant array storing all special castling moves.

Constructor Detail

Move

public Move(byte startsq,
            byte endsq)
Makes a "normal" move with no special modifier.

Parameters:
startsq - The starting square.
endsq - The destination square.

Move

public Move(byte startsq,
            byte endsq,
            byte modifier)
Makes a special move that requires a start, destination, and a modifier.

Parameters:
startsq - The starting square.
endsq - The ending square.
modifier - Modifiers: 0 = no modifier, 5 = en passant, 6 = promote to rook, 7 = promote to knight, 8 = promote to bishop, 9 = promote to queen.
Method Detail

isEqual

public boolean isEqual(Move m)
Checks whether another move object is the same as the given move object.

Parameters:
m - Another move object.
Returns:
Whether or not the move object is the same as this object.

getStartSquare

public byte getStartSquare()
Gets the starting square of this move object.

Returns:
The starting square.

getEndSquare

public byte getEndSquare()
Gets the ending square of this move object.

Returns:
The ending square.

getModifier

public byte getModifier()
Gets the modifier stored in this move.

Returns:
The modifier.

toString

public java.lang.String toString()
Returns a string describing this move.

Overrides:
toString in class java.lang.Object
Returns:
A string describing this move.

toString

public java.lang.String toString(Position p)
Converts the move object into expanded algebraic notation.

Parameters:
p - The current position, used to convert into expanded algebraic notation.
Returns:
A string, representing the expanded algebraic form of this move.

toMove

public static Move toMove(java.lang.String m_s)

stringTo0x88

public static byte stringTo0x88(java.lang.String sq)

x88ToString

public static java.lang.String x88ToString(byte sq)