PgnUtils

object PgnUtils

Utility object for parsing and handling PGN (Portable Game Notation) chess games. Provides methods to parse PGN strings, extract games, and apply moves to a board and game state.

Overview

  • Parsing: Converts PGN strings into PgnGame objects.

  • Move Application: Applies PGN moves to a board and game state.

Parsing Methods

  • parsePgn: Parses a single PGN game string into a PgnGame object.

  • parsePgnGames: Parses multiple PGN games from a text containing one or more games.

Move Application

  • applyPgnMoves: Applies the moves from a PgnGame to an initial board and game state.

Example Usage

val pgnGame = PgnUtils.parsePgn(pgnString)
val (board, gameState) = PgnUtils.applyPgnMoves(pgnGame)

Functions

Link copied to clipboard

Applies the moves from a PgnGame to an initial board and game state.

Link copied to clipboard
fun parsePgn(pgnString: String): PgnGame

Parses a single PGN game string into a PgnGame object.

Link copied to clipboard

Parses multiple PGN games from a text containing one or more games.