Skip to content

Opening Book

CheckAI supports Polyglot opening books (.bin format) for the analysis engine, providing well-known opening theory without search overhead.

What is a Polyglot Book?

Polyglot is the standard binary format for chess opening books. It maps board positions (via Zobrist hashes) to one or more book moves with weights, enabling the engine to quickly select theory-proven moves in the opening phase.

CheckAI uses the standard Polyglot Random64 Zobrist keys, so any .bin book generated by conforming tools (PolyGlot, pgn-extract, python-chess, Arena, etc.) will work out of the box.

Setup

  1. Obtain a Polyglot .bin file (e.g. from GitHub or chess communities)
  2. Place it in a known path, e.g. books/book.bin
  3. Start the server with the --book-path flag:
bash
checkai serve --book-path books/book.bin

Docker

Mount the book directory and configure the command:

yaml
volumes:
  - ./books:/home/checkai/books:ro
command:
  - serve
  - --book-path
  - books/book.bin

How It Works

  • During game analysis, the engine probes the opening book for each position
  • If the position is found, all matching book moves and their weights are retrieved
  • The played move is compared to book moves — if it matches, it is classified as a "book move" and the analysis skips the search for that position
  • Each book move carries a weight (frequency or strength indicator); higher weights represent stronger or more popular continuations
  • Move selection: The book is used for classification during analysis, not for automatic play. Agents still choose their own moves.
  • Once the position leaves book theory, the full search engine takes over

Weight Interpretation

Each position may have multiple book moves with different weights. The BookMoveInfo returned includes:

  • weight — the weight of the played move (0 if not a book move)
  • total_weight — sum of all book move weights for the position
  • book_moves — list of all book moves with individual weights and relative probabilities (weight / total_weight)

Supported Format

PropertyValue
FormatPolyglot .bin
LookupBinary search on Zobrist hash
Encoding16-byte entries (hash + move + weight + learn)

Released under the MIT License.