libscid snapshot+b450b7969924
Chess applications made easy.
Source on GitHub License GPL v2
Loading...
Searching...
No Matches
Core

Core is the chess model of libscid. It owns the in-memory representation of a game, the board state needed to validate and replay moves, and the value types that keep chess data portable across storage, PGN, notation and user-facing tools.


There are two central aggregates:

  • Game owns a complete game record: header data, optional non-standard start position, and the recursive movetext tree.
  • Position owns a board state at one moment in the game: pieces, side to move, castling rights, en-passant state, clocks, hashes, material and derived indexes.

Most higher-level work in Core is either about changing one of those aggregates, or about translating between them.


Movetext is the durable move tree inside a game. It stores move intent, comments, NAGs and variation structure, but it does not by itself prove legality or reconstruct board state. Move generation belongs to Position, where stored move intent can be resolved against a real board state.


Traversal supplies the cursor model for walking and editing that tree. When a caller needs a board, the cursor replays the stored move intent through Position.


Text formats sit around the model as mappings, not as owning state. PGN maps a complete game to and from text. Notation maps position-resolved moves to and from strings such as SAN or coordinate notation. Header metadata is structured inside GameHeader, with supplemental PGN tags preserved beside the typed fields.