|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--com.editev.chess.Chess
|
+--com.editev.chess.piece.Piece
|
+--com.editev.chess.piece.Pawn
The Pawn has four special cases; first move, en passant, capturing and promotion. This is the most complicated of all the Pieces, and there are two derived classes, Pawn.Black and Pawn.White.
the source here.| Inner Class Summary | |
static class |
Pawn.Black
This derivation of Pawn represents a Black pawn, and only differs from the White pawn by its list of moves. |
static class |
Pawn.White
This derivation of Pawn represents a White pawn, and only differs from the Black pawn by its list of moves. |
| Inner classes inherited from class com.editev.chess.Chess |
Chess.Black,
Chess.White |
| Field Summary | |
static byte |
EP_CAPTURE
Special piece indicates an en passant (e.p.) capture. |
| Fields inherited from class com.editev.chess.piece.Piece |
moves |
| Fields inherited from class com.editev.chess.Chess |
BLACK,
NO_MOVE,
NO_PIECE,
WHITE |
| Constructor Summary | |
protected |
Pawn(byte[][] moves)
|
| Method Summary | |
byte |
applyMoveToBoard(Move move,
Board board)
Apply the move to the squares of the board. |
void |
applyMoveToState(Move move,
GameState game)
Change the GameState component of the game for this pawn move -- we need to override this method because we need to store the e.p. |
boolean |
incrementMoveIndex(Move move)
Increment the move to the next one. |
boolean |
isCapture(Move move,
Board board)
We have to override this method because Pawns only capture diagonally. |
boolean |
isepCapture(Move move,
Board board)
Is this legal move an e.p. |
boolean |
isIllegal(Move move,
Game game)
Is this Pawn move legal? It may only move two squares on the first move. |
boolean |
isIrreversible(Move move,
Board board)
Pawn moves are never reversible. |
static boolean |
isPromotion(Move move)
Is this move a promotion for either color? |
static boolean |
isPromotion(Move move,
byte color)
Is this move a promotion for the given color? |
static boolean |
isTwoSquare(Move move)
Is this a two square move for the pawn? |
boolean |
moreMoves(Move move)
Any more moves? This is also overridden to take care of the promotions. |
void |
undoMoveToBoard(Move move,
Board board,
byte piece)
Unapply the move to the squares of the board. |
| Methods inherited from class com.editev.chess.piece.Piece |
firstMoveIndex,
getColumnOffset,
getRowOffset,
pieceBetween,
setMoveIndex |
| Methods inherited from class com.editev.chess.Chess |
notColor,
toColor,
toColor,
toColorName |
| Methods inherited from class java.lang.Object |
|
| Field Detail |
public static byte EP_CAPTURE
| Constructor Detail |
protected Pawn(byte[][] moves)
| Method Detail |
public boolean isIllegal(Move move,
Game game)
public boolean incrementMoveIndex(Move move)
public boolean moreMoves(Move move)
public byte applyMoveToBoard(Move move,
Board board)
public void undoMoveToBoard(Move move,
Board board,
byte piece)
public void applyMoveToState(Move move,
GameState game)
public boolean isIrreversible(Move move,
Board board)
public boolean isCapture(Move move,
Board board)
public static boolean isPromotion(Move move,
byte color)
public static boolean isPromotion(Move move)
public static boolean isTwoSquare(Move move)
public boolean isepCapture(Move move,
Board board)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||