|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectrules.Position.Piece
public final class Position.Piece
This is an immutable Piece class that stores the type and location of the piece. Once a Piece object is created, it cannot be changed. This avoids memory reference issues. To move a piece, simply use the movePiece method and reassign the reference.
Field Summary | |
---|---|
byte |
square
The square that the piece currently occupies. |
char |
type
The type of chess piece that this object represents. |
Constructor Summary | |
---|---|
Position.Piece(byte square,
char type)
Constructor: Constructs a given chess piece based on it's current square and its type. |
Method Summary | |
---|---|
Position.Piece |
movePiece(byte dest)
Moves a piece to it's destination. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public final byte square
public final char type
Constructor Detail |
---|
public Position.Piece(byte square, char type)
square
- The square that the piece occupies in the 0x88 scheme.type
- Capital for white pieces, lower-case for black pieces. p = pawn,
n = knight, b = bishop, r = rook, q = queen, and k = king.Method Detail |
---|
public Position.Piece movePiece(byte dest)
dest
- The square that the piece will occupy.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |