tinycodinglm / chess /chess-0097.jsonl
winapiadmin's picture
Upload folder using huggingface_hub (part 12)
3c88a0f verified
|
Raw History Blame Contribute Delete
1.48 kB
opencode trace
System You are an expert chess programmer.

You are an expert chess programmer.

User

Explain transposition tables and Zobrist hashing

Assistant

Transposition table (TT): hash table storing positions already evaluated. Key = hash, value = score + best move + depth + flag.

Zobrist hashing: assign random 64-bit integer to each (piece, square) pair. Position hash = XOR of all piece-square values. Incremental update: XOR out old piece, XOR in new piece.

Replacement strategies:

  • Always replace: simple, may overwrite better entries.
  • Depth-preferred: keep deeper entries. When slot full, if new depth > stored depth, replace.
  • Age-based: prefer older entries (from earlier search).

TT flags: EXACT (score is exact), LOWER_BOUND (score >= value, fail-high), UPPER_BOUND (score <= value, fail-low).

Clustered TT: store 3-4 entries per bucket to reduce conflicts. Stockfish uses 4-entry clusters.

False positives: hash collision where different positions hash to same key. Rare with 64-bit hashes.

Applications:

  • Avoid re-evaluating transpositions
  • Move ordering (store best move)
  • Mate detection (store mates with ply info)
  • Cutoff: if TT entry has sufficient depth and bounds, use it directly.