Zobrist hasing provides an efficient way of almost lossless mapping from a position to u64. This is required for several important things:
Caching evaluation results. Position evaluation typically takes a lot of time and memorizing evaluations for discovered positions speeds up the search by a significant margin. This is also possibly faster than querying Endgame Tablebases (since those are stored on disk) and might help even in that scenario.
MCGS and similar search structures often make use of transposition tables. Again, having a mapping between positions and a lightweight integer type is required to efficiently store e.g. the transition and search graph in memory.
The algorithm is relatively straightforward and detached from the rest of infrastructure and the API should be simple. The hash should be calculated for given Position, possibly stored inside of it and updated incrementally when a move is made (though this is an optimization that could be done later on). The difficulty might be generating good random numbers but those could be probably be taken from some pre-calculated known good results.
Zobrist hasing provides an efficient way of almost lossless mapping from a position to
u64
. This is required for several important things:The algorithm is relatively straightforward and detached from the rest of infrastructure and the API should be simple. The hash should be calculated for given
Position
, possibly stored inside of it and updated incrementally when a move is made (though this is an optimization that could be done later on). The difficulty might be generating good random numbers but those could be probably be taken from some pre-calculated known good results.Action items