Echecs.PGN (Echecs v0.1.5)

Copy Markdown View Source

Minimal PGN move-text parser and replayer.

parse_moves/1 strips comments, variations, move numbers, results and NAGs down to SAN tokens; replay/2 matches each token against legal moves and advances the game. Built for large-scale replay validation against Lichess database dumps (see test/integration/lichess_db_test.exs).

Summary

Functions

Parses a PGN move text (e.g., "1. e4 c5 2. Nf3") into a list of algebraic moves.

Replays a game from a list of algebraic moves starting from the given game state.

Functions

move_from_san(game, san)

parse_moves(pgn_body)

Parses a PGN move text (e.g., "1. e4 c5 2. Nf3") into a list of algebraic moves.

replay(game, moves)

Replays a game from a list of algebraic moves starting from the given game state.