OpeningBook

dicechess.engine.search.OpeningBook
object OpeningBook

The opening-book key contract shared between the engine (the consumer, via OpeningBookBot) and the analytics exporter (the producer, dicechess-analytics).

A key identifies a position together with its dice roll and is built as:

<piece-placement> <active-color> <castling> <en-passant> <dice>
  • The first four fields are the canonical normalized FEN from dicechess.engine.movegen.Dfen.normalizedFen — byte-for-byte the analytics normalized_fen. The half-move and full-move clocks are deliberately omitted: an opening book is independent of the move counters, and dropping them lets concrete positions that differ only by clock share a single book entry. The en-passant field is canonicalised (kept only when actually capturable) so positions that differ only by an uncapturable en-passant target — common when a Dice Chess turn double-pushes mid-turn — share one entry.
  • `` is the rolled piece letters (p n b r q k), sorted ascending and cased by the side to move — upper-case for White, lower-case for Black. This is identical to the analytics dice_sorted column. Example for White rolling bishop + pawn + rook: BPR.

The value mapped to a key is the chosen continuation as a comma-separated list of long-algebraic micro-moves (e.g. "e2e4,f1c4", with a promotion suffix such as "e7e8q" where applicable). OpeningBookBot matches it against the legal turn paths by move multiset, so the stored order is not significant.

Example key: rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - BPR

Any change to this format is a cross-repository breaking change and must be mirrored in the analytics exporter and its round-trip test.

Attributes

Source
OpeningBook.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Value members

Concrete methods

def key(state: GameState): Option[String]

Builds the canonical book key for state, or None when no dice have been rolled (the key is only meaningful for a rolled position — a chance node has no book entry).

Builds the canonical book key for state, or None when no dice have been rolled (the key is only meaningful for a rolled position — a chance node has no book entry).

Value parameters

state

the current game state; state.activeColor cases the dice letters

Attributes

Returns

Some(key) in the canonical format above, or None when state.dicePool is empty

Source
OpeningBook.scala