Chess Play Library
The Chess Play Library is a lightweight Kotlin-based library designed to handle chess game logic. It provides a robust set of tools for managing chess boards, piece movements, and standard notations.
Key Features
Board Management: Initialize a chess board with the standard starting position or any custom setup.
FEN Support: Import and export game states using Forsyth-Edwards Notation (FEN).
Move Execution: Perform moves using coordinate-based
Moveobjects or directly via Standard Algebraic Notation (SAN) strings likee4,Nf3, orO-O.Game Rules: Includes logic for piece reachability, captures, castling, en passant, and pawn promotion.
State Tracking: Automatically updates side to move, castling rights, en passant targets, halfmove clock, and fullmove number.
Move History: Maintains a chronological list of all moves played on the board.
Usage Examples
Initializing a Board
Performing Moves
Exporting State
Architecture
The library is built with a clean separation of concerns:
Board: The aggregate root representing the current game state and pieces.SanMapper: Handles the complexity of parsing human-readable notation into executable moves.ChessEngine: Cohesive engine for chess game logic, combining movement rules and board processing.FenMapper: Manages the conversion to and from the FEN string format.