Pgn Utils
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)Content copied to clipboard