Dfen

dicechess.engine.movegen.Dfen
object Dfen

Canonical DFEN normalization, shared with the dicechess-analytics position store.

The position dedup key (normalized_fen in analytics) and the opening-book key (OpeningBook.key) are the first four DFEN fields. Raw dicechess.engine.domain.FenParser.serialize writes an en-passant target after every pawn double-push, even when no capture is possible. In Dice Chess a turn spans several micro-moves, so the en-passant field at turn end is path-dependent: the same tactically-identical position serializes under many en-passant variants (target set vs cleared), which fragments the position store and the opening-book / equity samples.

normalizedFen removes that ambiguity with the X-FEN convention: an en-passant target is kept only when the side to move can actually capture it. Whether a capture exists is a move-generation property, so this lives next to PawnGeneration rather than in the pure-domain dicechess.engine.domain.FenParser (which must stay free of move-generation knowledge, and whose serialize/parse round-trip must remain intact).

The four-field result is, by contract, byte-for-byte the analytics normalized_fen. Any change here is a cross-repository breaking change and must be mirrored in the analytics normalizer and its round-trip test.

Attributes

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

Members list

Value members

Concrete methods

The capturable subset of state.enPassant: the en-passant target squares the side to move can actually reach with a pawn capture. Empty when the naive target(s) cannot be captured — no adjacent friendly pawn, wrong rank, or (defensively) an occupied target square.

The capturable subset of state.enPassant: the en-passant target squares the side to move can actually reach with a pawn capture. Empty when the naive target(s) cannot be captured — no adjacent friendly pawn, wrong rank, or (defensively) an occupied target square.

Attributes

Source
Dfen.scala
def normalize(fen: String): Either[String, String]

Parses fen and returns its normalizedFen, or Left with the parse error.

Parses fen and returns its normalizedFen, or Left with the parse error.

Attributes

Source
Dfen.scala
def normalizedFen(state: GameState): String

The first four DFEN fields with the en-passant field canonicalised — byte-for-byte the analytics normalized_fen. Placement, active colour and castling are taken verbatim from dicechess.engine.domain.FenParser.serialize so only the en-passant field can change.

The first four DFEN fields with the en-passant field canonicalised — byte-for-byte the analytics normalized_fen. Placement, active colour and castling are taken verbatim from dicechess.engine.domain.FenParser.serialize so only the en-passant field can change.

Attributes

Source
Dfen.scala