Package-level declarations

Types

Link copied to clipboard
class Bitboard

This class represents a bitboard.

Link copied to clipboard
class EcoInfo

A container class representing the information about a chess opening based on the Encyclopedia of Chess Openings (ECO). It is immutable.

Link copied to clipboard
class Game

Class for manipulating games. It allows starting a game from a configurable initial position and with various configuration options, such as the game type (match or analysis), and how to apply the three-fold repetition and 50-move rules.

Link copied to clipboard
class Move

Represents a single player's move on the board. It does not store information about the origin position, as its primary purpose is move representation. Its string representation is the full algebraic notation of the move as used in the UCI protocol (e.g., "e2e4", "a7a8q"). It is immutable.

Link copied to clipboard
class Node

Each game can be interpreted as a series of interconnected nodes in a tree. Each node is move in the game and holds information about the board state after that move. Additionally, each node can have regular or end-of-line comments, suffix annotations, as well as more than one child (from the second child onwards, they are variations), and always only one parent node.

Link copied to clipboard
class Notation

This class represents the types of move notation supported by this library. This class is used as an argument in functions related to move validation and generation logic.

Link copied to clipboard
class Piece

This class represents the chess pieces on the board. Each piece has a corresponding side (color).

Link copied to clipboard
class Position

Class to represent a position on the chessboard. It is immutable.

Link copied to clipboard
class Side

This enum represents the two sides (colors) in a chess game: White or Black.

Link copied to clipboard
class Square

This enum represents the squares on the chessboard. The order is set such that when calling ordinal, the integer 0 corresponds to A1, 1 corresponds to B1, and so on, following the file-major order (A1, B1, C1... H1, A2, B2... H8), with 63 corresponding to H8.

Link copied to clipboard
class Tuple

Auxiliary generic class to represent a pair of position and associated move. It is immutable.

Properties

Link copied to clipboard
val A1: Square
Link copied to clipboard
val A2: Square
Link copied to clipboard
val A3: Square
Link copied to clipboard
val A4: Square
Link copied to clipboard
val A5: Square
Link copied to clipboard
val A6: Square
Link copied to clipboard
val A7: Square
Link copied to clipboard
val A8: Square
Link copied to clipboard
val B1: Square
Link copied to clipboard
val B2: Square
Link copied to clipboard
val B3: Square
Link copied to clipboard
val B4: Square
Link copied to clipboard
val B5: Square
Link copied to clipboard
val B6: Square
Link copied to clipboard
val B7: Square
Link copied to clipboard
val B8: Square
Link copied to clipboard
val BB: Piece

Black Bishop

Link copied to clipboard
val BK: Piece

Black King

Link copied to clipboard
val BLACK: Side

Black Player

Link copied to clipboard
val BN: Piece

Black Knight

Link copied to clipboard
val BP: Piece

Black Pawn

Link copied to clipboard
val BQ: Piece

Black Queen

Link copied to clipboard
val BR: Piece

Black Rook

Link copied to clipboard
val C1: Square
Link copied to clipboard
val C2: Square
Link copied to clipboard
val C3: Square
Link copied to clipboard
val C4: Square
Link copied to clipboard
val C5: Square
Link copied to clipboard
val C6: Square
Link copied to clipboard
val C7: Square
Link copied to clipboard
val C8: Square
Link copied to clipboard
val D1: Square
Link copied to clipboard
val D2: Square
Link copied to clipboard
val D3: Square
Link copied to clipboard
val D4: Square
Link copied to clipboard
val D5: Square
Link copied to clipboard
val D6: Square
Link copied to clipboard
val D7: Square
Link copied to clipboard
val D8: Square
Link copied to clipboard
val E1: Square
Link copied to clipboard
val E2: Square
Link copied to clipboard
val E3: Square
Link copied to clipboard
val E4: Square
Link copied to clipboard
val E5: Square
Link copied to clipboard
val E6: Square
Link copied to clipboard
val E7: Square
Link copied to clipboard
val E8: Square
Link copied to clipboard

Represents an empty square on the board.

Link copied to clipboard
val F1: Square
Link copied to clipboard
val F2: Square
Link copied to clipboard
val F3: Square
Link copied to clipboard
val F4: Square
Link copied to clipboard
val F5: Square
Link copied to clipboard
val F6: Square
Link copied to clipboard
val F7: Square
Link copied to clipboard
val F8: Square
Link copied to clipboard
val G1: Square
Link copied to clipboard
val G2: Square
Link copied to clipboard
val G3: Square
Link copied to clipboard
val G4: Square
Link copied to clipboard
val G5: Square
Link copied to clipboard
val G6: Square
Link copied to clipboard
val G7: Square
Link copied to clipboard
val G8: Square
Link copied to clipboard
val H1: Square
Link copied to clipboard
val H2: Square
Link copied to clipboard
val H3: Square
Link copied to clipboard
val H4: Square
Link copied to clipboard
val H5: Square
Link copied to clipboard
val H6: Square
Link copied to clipboard
val H7: Square
Link copied to clipboard
val H8: Square
Link copied to clipboard

The Standard Algebraic Notation (SAN) used in books and PGN files (e.g., Nf3, O-O, cxd4).

Link copied to clipboard

The long algebraic notation used in the Universal Chess Interface (UCI) protocol (e.g., e2e4, a7a8q).

Link copied to clipboard
val WB: Piece

White Bishop

Link copied to clipboard
val WHITE: Side

White Player

Link copied to clipboard
val WK: Piece

White King

Link copied to clipboard
val WN: Piece

White Knight

Link copied to clipboard
val WP: Piece

White Pawn

Link copied to clipboard
val WQ: Piece

White Queen

Link copied to clipboard
val WR: Piece

White Rook

Functions

Link copied to clipboard
fun analysisGame(idSupplier: () -> Any? = { null }): Game

Creates a new Game instance configured for analysis. Uses ANALYSIS with AWARE, making the game fully mutable.

Link copied to clipboard
fun customGame(gameMode: String, threeRepetitionsMode: String, fiftyMovesRuleMode: String, initialFen: String? = null, idSupplier: () -> Any? = { null }): Game

Creates a new Game instance with fully customizable parameters. Allows setting the game mode, rule enforcement, initial FEN, and PGN tags.

Link copied to clipboard
fun moveOf(move: String): Move

Creates a Move object from its UCI notation string (e.g., "e7e8q").

Link copied to clipboard
fun parseGames(pgnInput: String, idSupplier: () -> Any? = { null }): JsReadonlyArray<Game>

Parses a string containing one or more games in Portable Game Notation (PGN) format. Games are returned in ANALYSIS mode, making them mutable for subsequent use.

Link copied to clipboard

Factory function to create a Position object from a FEN string. Throws an exception if the FEN string is invalid or leads to an illegal position.

Link copied to clipboard

Returns the standard starting Position (the startpos FEN).

Link copied to clipboard
fun strictMatch(idSupplier: () -> Any? = { null }): Game

Creates a new Game instance configured for strict competitive match play. Uses MATCH with strict enforcement for the three-fold repetition and 50-move rules.