public class ChessBoardModel extends Object implements ChessPosition, Serializable
| Constructor and Description |
|---|
ChessBoardModel() |
| Modifier and Type | Method and Description |
|---|---|
void |
clear() |
void |
clearSquare(ChessBoardCoord coord) |
boolean |
equals(Object obj) |
int |
getHalfMoveClock()
This is the number of halfmoves since the last capture or pawn advance.
|
ChessBoardCoord |
getLastPawnDMove()
If a pawn has just moved two squares ahead, this will be the destination of this pawn.
|
int |
getMoveNumber()
Get the move number.
|
ChessSide |
getNextPlayerTurn()
Get the next player to move.
|
ChessPiece |
getPiece(ChessBoardCoord coordinates)
Get a piece from the board.
|
int |
hashCode() |
boolean |
isCastlingAvailable(ChessSide side,
boolean kingside)
Check if castling is available at the current position.
|
void |
movePiece(ChessBoardCoord src,
ChessBoardCoord dst) |
void |
nextPlayerTurn() |
void |
setCastlingAvailable(ChessSide side,
boolean kingside,
boolean available) |
void |
setHalfMoveClock(int halfMoveClock) |
void |
setInitialPosition() |
void |
setLastPawnDMove(ChessBoardCoord lastPawnDMove) |
void |
setMoveNumber(int moveNumber) |
void |
setNextPlayerTurn(ChessSide nextPlayerTurn) |
void |
setPiece(ChessBoardCoord coord,
ChessPiece piece) |
void |
setPosition(ChessPosition position) |
String |
toString() |
public void setPosition(ChessPosition position)
public int getMoveNumber()
ChessPositiongetMoveNumber in interface ChessPositionpublic void setMoveNumber(int moveNumber)
public int getHalfMoveClock()
ChessPositiongetHalfMoveClock in interface ChessPositionpublic void setHalfMoveClock(int halfMoveClock)
public ChessPiece getPiece(ChessBoardCoord coordinates)
ChessPositiongetPiece in interface ChessPositioncoordinates - the piece coordinatespublic void setPiece(ChessBoardCoord coord, ChessPiece piece)
public void clearSquare(ChessBoardCoord coord)
public void clear()
public void movePiece(ChessBoardCoord src, ChessBoardCoord dst)
public void setInitialPosition()
public boolean isCastlingAvailable(ChessSide side, boolean kingside)
ChessPositionisCastlingAvailable in interface ChessPositionside - which player should we check (may not be the next player of the position)kingside - which castling side ? True for king side, false for queen side.public void setCastlingAvailable(ChessSide side, boolean kingside, boolean available)
public void nextPlayerTurn()
public ChessSide getNextPlayerTurn()
ChessPositiongetNextPlayerTurn in interface ChessPositionpublic void setNextPlayerTurn(ChessSide nextPlayerTurn)
public ChessBoardCoord getLastPawnDMove()
ChessPositiongetLastPawnDMove in interface ChessPositionpublic void setLastPawnDMove(ChessBoardCoord lastPawnDMove)
Copyright © 2017. All rights reserved.