Position
Class to represent a position on the chessboard. It is immutable.
This class provides all the necessary information to perform conventional logical operations based on a position, primarily through bitboard representations. This class cannot be instantiated directly but must be accessed via the factory function positionOf, which ensures the provided FEN string (if any) is well-formed and valid.
Since
1.0.0-beta.1
Author
lunalobos
Properties
True if Black can castle kingside (short castling). False otherwise.
True if Black can castle queenside (long castling). False otherwise.
The square exposed to an en passant capture, if one exists. Returns null if no en passant capture is possible in the current position.
True if the position has reached or exceeded 50 half-moves without a pawn move or capture.
The number of half-moves since the last pawn move or capture. This is used for the 50-move rule.
True if the position is a draw due to insufficient mating material (e.g., King vs. King). False otherwise.
The full move number in the game (starts at 1 and is incremented after Black's move).
The side (Side.WHITE or Side.BLACK) whose turn it is to move.
True if White can castle kingside (short castling). False otherwise.
True if White can castle queenside (long castling). False otherwise.
Functions
Returns true if the evaluated Move is legal in the current position, and false otherwise.
Returns true if the move specified in the given notation is legal in the current position. If no notation is specified, Notation.UCI is assumed.
Retrieves the new Position that results from executing the provided legal Move. Throws a MoveException if the provided move is not legal in the current position.
Retrieves the new Position that results from executing the move specified in the given notation. Throws a MoveException if the move is not legal. If no notation is provided, Notation.UCI is assumed.