Package-level declarations

Handles everything related to the chessboard: board representation, squares, files (columns), and ranks (rows). Responsible for tracking piece positions, validating moves, and setting up positions (including from FEN strings).

Types

Link copied to clipboard
class Board(squaresMap: MutableMap<Square, Piece?> = mutableMapOf())

The Board class represents the positions of pieces on a chessboard at a specific moment. It tracks which Piece occupies each of the 64 squares, if any. This class focuses solely on the arrangement of pieces and provides methods for querying and updating positions, applying moves to generate new board configurations, and accessing pieces by square or algebraic notation. It does not track additional game state details such as castling rights, en passant targets, or move history.

Link copied to clipboard
value class File(val value: Char)

The File class represents a column on a chessboard, ranging from 'a' to 'h'. It provides methods for manipulating and querying file values, converting them to array indices, and performing arithmetic operations.

Link copied to clipboard
value class Rank(val value: Int)

The Rank class represents a row on a chessboard, ranging from 1 to 8. It provides methods for manipulating and querying rank values, performing arithmetic operations, and validating ranges.

Link copied to clipboard
data class Square(val file: File, val rank: Rank)

The Square class represents a square on a chessboard, defined by a File (column) and a Rank (row). It provides methods for parsing algebraic notation, determining square color, and string representation.

Functions

Link copied to clipboard
operator fun CharRange.contains(file: File): Boolean

Extension function to check if a File is within a CharRange.

operator fun IntRange.contains(rank: Rank): Boolean

Extension function to check if a Rank is within an IntRange.