Planning & Search in Rust
Esc

Loading…

↑↓ move ↵ open Esc close
Colour theme
All algorithms

Transposition table

Also known as Hash table (game-tree search)

adversarial game-tree-search

A transposition table remembers what a search learned about a position: its score, whether the score is exact or a bound, and the best move. When another move order reaches the same position, the search answers from the table instead of searching again. An entry answers only at the same remaining depth, or at any depth from its reach on if its search was proven. An exact entry always answers, a bound only when it lies outside the window; the stored best move is tried first otherwise. SlotTable has a fixed number of slots and replaces on every store; MapTable (feature hashbrown) holds entries in a hash map up to a size cap.

Pseudocode

algorithm Alpha-beta-with-table(p, d, α, β, ply)input: position p, depth d, window (α, β), moves from the root ply, table Toutput: the score Alpha-beta(p, d, α, β) returns, with the same boundif d = 0 or moves(p) = ∅ thenreturn evaluate(p)e ← T[key(p)]if ply > 0 and e ≠ nil and serves(e, d) then  ▷ the root is always searchedif kind(e) = exact or (kind(e) = at-least and score(e) ≥ β) or (kind(e) = at-most and score(e) ≤ α) thenreturn score(e)                          ▷ a bound answers only outside the window; it never narrows itif e ≠ nil and best(e) ≠ nil thenmove best(e) to the front of moves(p)v, kind, m ← search the moves of p within (α, β), as Alpha-beta doesT[key(p)] ← (d, v, kind, m, proven, reach)   ▷ SlotTable replaces what the slot heldreturn vfunction serves(e, d)return depth(e) = d or (proven(e) and d ≥ reach(e))   ▷ a deeper entry would give another score

In the crates

  • game-tree-search

    Remembers scores, bounds and best moves by position key, so a position reached by another move order is answered instead of searched; SlotTable is fixed-size, MapTable (feature hashbrown) grows.

    HashedSlotTable

Lineage

Comes from

Nothing on this site.

Led to

Lazy SMP combines it

Lockless transposition table builds on it

MTD(f) combines it

Papers

  1. The Greenblatt chess program Richard D. Greenblatt, Donald E. Eastlake, Stephen D. Crocker · 1967· AFIPS '67 (Fall): Proceedings of the November 14-16, 1967, fall joint computer conference introduces doi 10.1145/1465611.1465715
  2. A New Hashing Method with Application for Game Playing Albert L. Zobrist · 1990· ICCA Journal (reprint of the 1970 technical report) extends doi 10.3233/icg-1990-13203