Pawn Hash Table
Home * Evaluation * Pawn Structure * Pawn Hash Table
A Pawn Hash Table is often used inside a chess programs to cache purely pawn related pattern and evaluation stuff. Compared to the main transposition table, since the pawn structure inside the search changes rarely or transpose, the number of cached entries required might be quite low (a few K) to get a sufficient hit rate above 95% or even 99% for most positions, specially if the pawn structure is settled or relatively fixed after the opening. On the other hand, most programmers store not only pure aggregated pawn evaluation scores, but other computation expensive pawn structure stuff which is used in second pass evaluation considering pieces and king. Terms for various game phases and king origins for all possible wings/center per side are often calculated speculatively, i.e. pawn shield or pawn storm stuff later used by king safety.
While the content of the pawn hash table entry varies a lot between different chess programs and their implementation, it is not uncommon that one entry exceeds 1/2 K-Byte. Some programs store sets or bitboards of strong pawns (passers, candidates), square of most advanced passer, different kind of weak pawn sets and whatever else. Despite, some programs cache pawn-king stuff separately which requires king squares included inside the index calculation as well table entry for verifications.
Contents
Pawn Hash Index
Most simple, common and recommend is to keep an incremental updated, dedicated Zobrist- or BCH-keys similar to the main transposition table, initialized from all squares occupied by pawns only, side to move does not matter. The update of that key is therefor only necessary for the relative rare pawn moves or captures with pawns as aggressor or victim. The hash table index is computed by key modulo number of entries, which might be a cheap and-instruction from the key for power of two sized tables.
Alternatively, considering hits from the transposition table, or a dedicated evaluation hash table, one may use a fast hash function to compute an index from the white and black pawn bitboards on the fly, i.e. either a modulo or a multiplication and shift à la magic bitboards by the difference of the disjoint pawn sets [2] . To verify correct entries while probing, one needs either to store (a part) of the dedicated Zobrist/BCH key, or for 100% correctness 2*48 bits from the pawn occupancy bitboards. This value could be further compressed with the expense of more calculation overhead by means of n-like men:
This can be further reduced by mirroring the board, considering symmetric positions or detecting illegal positions.
See also
Forum Posts
1999
- Q: pawn hash? by Scott Gasch, CCC, July 20, 1999
- regular hash key & pawn hash key together - good idea? by Tom Kerrigan, CCC, September 16, 1999
2000 ...
- A question about pawn hash tables by Andreas Herrmann, CCC, September 13, 2000
- A few hashing questions by Severi Salminen, CCC, December 02, 2001
- Pawn Hash Collisions in Crafty by David Rasmussen, CCC, December 05, 2001
- Crafty's 32-bit pawn hash collision figures? by Severi Salminen, CCC, December 06, 2001
- Pawn hash table: need some helps? by Pham Hong Nguyen, CCC, June 23, 2002
- Ultra small pawn hash efficiency by Vladimir Medvedev, CCC, November 21, 2002
- programmers: pawn hash tables by Joel, CCC, March 08, 2003
- pawn hash tables by Joshua Lee, CCC, August 01, 2003
- The key of pawn hash tables is based on what exactly? by Uri Blass, CCC, September 06, 2003
- Pawn hashing without Zobrist keys by Gerd Isenberg, CCC, September 12, 2003
- Pawn Hash Question by Dan Honeycutt, CCC, March 15, 2004
- Which pawn positions go into a pawn hash table? by pd42, rgcc, May 26, 2004
- pawn hash by Tor Lattimore, CCC, July 03, 2004
- Initialization of pawn hash table by Zach Wegner, CCC, September 26, 2004
2005 ...
- About pawn hash tables by Uri Blass, CCC, May 10, 2007
- An interesting bug in Hamsters by Alessandro Scotti, CCC, August 02, 2007 » Hamsters
2010 ...
- Pawn Hash by Philippe Gailhac, CCC, February 10, 2010
- Pawn Hash by Harm Geert Muller, CCC, March 18, 2010
- Possible pawn hash speed optimization? by John Merlino, CCC, September 19, 2011
- Is there a reasonable number of pawn hash entries? by Fermin Serrano, CCC, July 10, 2012
2015 ...
- pawn hash and ep by J. Wesley Cleveland, CCC, February 01, 2016
- Buckets for pawn hash? by J. Wesley Cleveland, CCC, February 04, 2016
- pawn hash and eval tuning by J. Wesley Cleveland, CCC, February 21, 2016 » Automated Tuning
- hash eval, hash pawn or twice ? by Daniel Anulliero, March 19, 2016 » Evaluation Hash Table
- Pawn hash by Karlo Balla, CCC, October 06, 2016
- pawn hash by Volker Annuss, CCC, November 18, 2016
- A pre-calculated pawn hash table ? by Ed Schröder, CCC, July 05, 2019
- Pawn hash table, a little disappointment by Vivien Clauzon, CCC, October 28, 2019
External Links
- Transposition table - Related techniques, from Wikipedia
- Chess Engine Anomalies, evidently caused by hash-table collisions and effects of multithreading by Kenneth W. Regan
References
- ↑ Chess Woodcuts Graphic Arts Woodcut Art by Elke Rehder
- ↑ Pawn hashing without Zobrist keys by Gerd Isenberg, CCC, September 12, 2003