Changes

Jump to: navigation, search

Hashing Dictionaries

304 bytes removed, 17:25, 27 June 2021
no edit summary
'''[[Main Page|Home]] * [[Board Representation]] * [[Bitboards]] * [[Sliding Piece Attacks]] * Hashing Dictionaries'''
This approach using associate arrays or [[Hash Table|hash tables]] was introduced in the [[ICGA Journal]] (June 2007) by [[Sam Tannous]] <refname="ICGAJ">[[Sam Tannous]] ('''2007'''). ''[http://arxiv.org/abs/0704.3773 Avoiding Rotated Bitboards with Direct Lookup]''. [[ICGA Journal#30_2|ICGA Journal, Vol. 30, No. 2]], [httphttps://arxiv.org/PS_cache/arxiv/pdfabs/0704/.3773 arXiv:0704.3773v2.pdf pdf3773]</ref>. Like other [[Occupancy|occupancy]] lookup approaches it works line-wise for ranks, files, diagonals and anti-diagonals. It uses hash arrays from an interpreted, high level language, [[Python]]:
Many high level programming languages (notably [[Python]] (van Rossum, 1993)) have useful predefined data structures (e.g. associative arrays) which are dynamically resizable hash tables that resolve collisions by probing techniques. The basic lookup function used in Python is based on Algorithm D: Open Addressing with Double Hashing from Section 6.4 in Knuth <ref>[[Donald Knuth]] ('''1998'''). ''The Art of Computer Programming''. Volume 3, Sorting and Searching. Addison Wesley. ISBN 0201896850</ref>.
Sam Tannous compared this approach to a [[Rotated Bitboards]] implementation in Python and found direct lookup favorable for move generation. In languages like [[C]], targeting 64-bit cpus like [[x86-64]], or even in [[Java]], it is likely another story if one compares ''Open Addressing with Double Hashing'' with [[Rotated Bitboards|rotated]] or [[Hash Table#PerfectHashing|perfect hashing]] techniques like [[Kindergarten Bitboards|Kindergarten]] or even [[Magic Bitboards]].
==Abstract==Quoted from ''Avoiding Rotated Bitboards with Direct Lookup''<ref name="ICGAJ"/>:
This paper describes an approach for obtaining direct access to the attacked squares of sliding pieces without resorting to rotated bitboards. The technique involves creating four [[Hash Table|hash tables]] using the built in hash arrays from an interpreted, high level language. The rank, file, and diagonal occupancy are first isolated by masking the desired portion of the board. The attacked squares are then directly retrieved from the hash tables. Maintaining incrementally updated rotated bitboards becomes unnecessary as does all the updating, mapping and shifting required to access the attacked squares. Finally, rotated bitboard move generation speed is compared with that of the direct hash table lookup method.
=External Links=Toolkit== * [http://docs.python.org/lib/module-UserDict.html UserDict - Class wrapper for dictionary objects] from [http://docs.python.org/lib/lib.html Python Library Reference]* [http://docs.python.org/lib/defaultdict-objects.html defaultdict objectsShatranj (Toolkit)] from [http://docs.python.org/lib/lib.html Python Library Reference]
=References=
<references />
 
'''[[Sliding Piece Attacks|Up one Level]]'''

Navigation menu