Transposition Tables
A transposition table (hash table) stores score information about subtrees already searched. If position P is reached more than one way, the second time search reaches P it can, ideally, retrieve score information without redoing the work.
Each position has a 64-bit signature built from piece placement, side to move, castling rights, etc. A hashing function maps that signature to a table entry. Since the table is finite, two positions can collide — the entry must store some of the signature so a probe can detect "this is a different position" rather than trusting stale data. A replacement scheme governs when an existing entry may be overwritten.
Typhoon's collision/replacement strategy lives in
hash.c
— see _SelectHashEntry. The hash entry size (16 bytes) was
chosen to line up with CPU cache-line size; one slot of each four-entry
group acts as an always-store table, one as a depth-priority table,
and the remaining two catch overflow from either.
Besides its signature, each entry stores score data: "exactly X," "at least X" (lower bound, stored on fail-high), or "at most X" (upper bound, stored on fail-low) — plus the depth to which the position was searched before storing. Typhoon uses about 256MB for its main transposition table, probing four entries at a time.
The multithreaded search locks 1/64th of the main hash table at a time to prevent corruption across searcher threads — cheap, with low contention. Pawn hash entries are locked individually, with other threads multi-probing after spinning a while rather than blocking on a thread evaluating the same pawn configuration; because of this, Typhoon tends to run a larger pawn hash table than most engines.
Transposition tables are a classic breeding ground for chess engine bugs — the best way to get one right is to be sure you fully understand alpha-beta search and exactly what the hash table is doing, then read other engines' hashing code.