TranspositionTable

dicechess.engine.search.TranspositionTable
See theTranspositionTable companion object
class TranspositionTable(capacityPowerOfTwo: Int = ...)

Fixed-size, thread-safe Transposition Table for expectimax search.

Stored in flat primitive arrays to ensure zero-GC pressure on hot search paths.

Concurrency contract — racy-reader safe, not general-purpose thread-safe: the classic lockless scheme (Hyatt). A checksum over ALL entry fields is written alongside each entry; a reader that observes a mixed or torn snapshot fails the checksum and reports a miss, so concurrent readers can lose entries but never observe a corrupt one (residual false-accept probability ~2⁻⁶⁴). There is no memory-ordering guarantee, so readers may also see stale — but internally consistent — entries. Single writer recommended until the parallel-search stage (#61) revisits publication with JVM fences.

Lifetime contract: entries encode only (position, evaluator) — for a FIXED evaluator an EXACT value never goes stale, across moves or games; that is why entries carry no generation field. The table is therefore bound to one evaluator: it is owned by the search instance that created it and must never be shared between models. Call clear when reusing an instance across games only if you want fresh telemetry or replacement pressure — not for correctness.

Value parameters

capacityPowerOfTwo

table capacity, must be a power of two (default 2^18 = 262,144 entries)

Attributes

Companion
object
Source
TranspositionTable.scala
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def clear(): Unit

Attributes

Source
TranspositionTable.scala
def collisions: Long

Attributes

Source
TranspositionTable.scala
def hitRate: Double

Attributes

Source
TranspositionTable.scala
def hits: Long

Attributes

Source
TranspositionTable.scala
def misses: Long

Attributes

Source
TranspositionTable.scala
def overwrites: Long

Attributes

Source
TranspositionTable.scala
def probe(key: Long): Option[TTEntry]

Probes the transposition table for key.

Probes the transposition table for key.

Returns Some(TTEntry) on a hit with valid checksum, or None on a miss or concurrent write race.

Attributes

Source
TranspositionTable.scala
def resetTelemetry(): Unit

Attributes

Source
TranspositionTable.scala
def store(key: Long, value: Double, bound: TTBound, depth: Int, lossTainted: Boolean): Unit

Stores an entry in the transposition table using a depth-preferred replacement policy.

Stores an entry in the transposition table using a depth-preferred replacement policy.

depth must fit the byte-wide slot: the depth-3 work (#60) stays far below the 255 cap, and a silent wrap here would let a shallow entry masquerade as a deep one.

Attributes

Source
TranspositionTable.scala
def stores: Long

Attributes

Source
TranspositionTable.scala