Changes

Jump to: navigation, search

Hashing Dictionaries

74 bytes added, 10:28, 9 July 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>.
=Avoiding Rotated Bitboards with Direct Lookup=
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==* [[Shatranj (Toolkit)]] =Forum Posts= * [http://docswww.pythontalkchess.orgcom/libforum3/module-UserDictviewtopic.html UserDict php?f=7&t=40503&start=10 Re: Explain like I'm five - Class wrapper for dictionary objectswhat is the 'n' in right shift 6] from by Bayowulf, [http://docs.python.org/lib/lib.html Python Library Reference[CCC]], September 24, 2011* [http://docswww.pythontalkchess.orgcom/libforum3/defaultdict-objectsviewtopic.html defaultdict objectsphp?f=7&t=77648 What is the point of magic hashing over simply using masked occupancy as index ?] by Gautier Blandin, [[CCC] from ], July 06, 2021 » [http://docs.python.org/lib/lib.html Python Library Reference[Magic Bitboards]]
=References=
<references />
 
'''[[Sliding Piece Attacks|Up one Level]]'''

Navigation menu