|
|||||||||
| 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.Board
|
+--com.editev.chess.GameState
Represents the State of a game of chess, including the Board position, and castling status, e.p. moves, 50 move rule, etc.
the source here.| Inner classes inherited from class com.editev.chess.Chess |
Chess.Black,
Chess.White |
| Field Summary | |
(package private) byte |
epColumn
Which row the previous (2-square, pawn) move was in, for a possible e.p., or NO_EP_COLUMN if none. |
(package private) boolean[] |
kingMoved
Have the { White, Black } kings moved yet? |
(package private) int |
moves
Moves since the start of the game. |
static byte |
NO_EP_COLUMN
This constant represents the very common case where the last move didn't introduce the possibility of an en passant capture in the next move. |
(package private) int |
reversibleMoves
Moves since the last irreversible move. |
(package private) boolean[][] |
rookMoved
Have the { {WK, WQ}, {BK, BQ} } rooks moved yet? |
| Fields inherited from class com.editev.chess.Board |
PIECE_NAMES,
PIECES,
squares |
| Fields inherited from class com.editev.chess.Chess |
BLACK,
NO_MOVE,
NO_PIECE,
WHITE |
| Constructor Summary | |
GameState()
|
|
| Method Summary | |
boolean |
canBeCaptured(byte piece)
Can this piece be captured by the player on the move? \ |
boolean |
canMove(byte piece)
Does this piece belong to the player on-the-move? |
void |
clearEP()
Clear the enpassant column, the last move wasn't a pawn or wasn't two squares. |
byte |
getEP()
|
int |
getMoves()
Moves since start of game. |
int |
getReversibleMoves()
Get the number of moves since an irreversible move has occurred (50 move rule). |
void |
incrementMoves()
Moves since start of game. |
void |
irreversibleMove()
An irreversible move has occurred, which must be a capture or a pawn move (50 move rule). |
boolean |
isWhiteMove()
Is white on the move? |
boolean |
kingMoved(byte king)
Has a king been moved? |
void |
moveKing(byte king)
Marks a king as having been moved. |
void |
moveRook(byte rook,
boolean kSide)
Mark a rook as having been moved. |
boolean |
rookMoved(byte rook,
boolean kSide)
Has a rook been moved? |
void |
setEP(byte column)
Set the e.p. |
| Methods inherited from class com.editev.chess.Board |
clone,
cloneBoard,
copyFrom,
equals,
findPieceSquare,
getPiece,
getPiece,
getPieceIndex,
getPieceIndex,
hasPiece,
inCheck,
isAttacked,
resultsInCheck,
setPieceIndex,
toString |
| Methods inherited from class com.editev.chess.Chess |
notColor,
toColor,
toColor,
toColorName |
| Methods inherited from class java.lang.Object |
|
| Field Detail |
boolean[] kingMoved
boolean[][] rookMoved
int reversibleMoves
int moves
public static final byte NO_EP_COLUMN
byte epColumn
| Constructor Detail |
public GameState()
| Method Detail |
public int getMoves()
public void incrementMoves()
public boolean isWhiteMove()
public boolean canMove(byte piece)
public boolean canBeCaptured(byte piece)
public boolean kingMoved(byte king)
color - a piece to indicate the color.public void moveKing(byte king)
color - a piece to indicate the color.
public boolean rookMoved(byte rook,
boolean kSide)
color - a piece to indicate the color.isKingSide - true if we are looking at the kingside rook
public void moveRook(byte rook,
boolean kSide)
color - a piece to indicate the color.isKingSide - true if we are looking at the kingside rookpublic void irreversibleMove()
public int getReversibleMoves()
public void setEP(byte column)
public void clearEP()
public byte getEP()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||