| Package | com.lookbackon.ds |
| Class | public class ZobristHashTable |
| Inheritance | ZobristHashTable HashTable Object |
See also
| Method | Defined By | ||
|---|---|---|---|
ZobristHashTable(size:int, zobristKey:int)
An important issue is the question of what size the hash keys should have. | ZobristHashTable | ||
![]() | clear():void
Clears all items. | HashTable | |
![]() | contains(obj:*):Boolean
Determines if the collection contains a given item. | HashTable | |
dump():String [override]
Prints out all elements (for debug/demo purposes). | ZobristHashTable | ||
![]() | find(key:*):*
Finds the entry that is associated with the given key. | HashTable | |
![]() |
Initializes an iterator object pointing to the first item in the
collection. | HashTable | |
![]() | hashInt(i:int):int [static]
A simple function for hashing integers. | HashTable | |
![]() | hashString(s:String):int [static]
A simple function for hashing strings. | HashTable | |
![]() | insert(key:*, obj:*):void
Inserts a key/data couple into the table. | HashTable | |
![]() | isEmpty():Boolean
Checks if the collection is empty. | HashTable | |
![]() | remove(key:*):*
Removes an entry based on a given key. | HashTable | |
![]() | toArray():Array
Converts the collection into an array. | HashTable | |
![]() | toString():String
Prints out a string representing the current object. | HashTable | |
If we now want to get the Zobrist hash code of a certain position,
we initialize the hash key bei xoring all random numbers linked to the given feature.
E.g the starting position:
[Hash for White Rook on a1] xor [White Knight on b1] xor [White Bishop on c1] xor ... | ZobristHashTable | ||
| ZobristHashTable | () | Constructor |
public function ZobristHashTable(size:int, zobristKey:int)An important issue is the question of what size the hash keys should have. Smaller hash keys are faster and more space efficient, while larger ones reduce the risk of a hash collision. A collision occurs if two positions map the same key [7] . The dangers of which were well assessed by Robert Hyatt and Anthony Cozzie in their paper Hash Collisions Effect [8] . Usually 64bit are used as a standard size in modern chess programs. But our chinese chess jam using 32bit size.
Parameterssize:int — what size the hash keys should have.
| |
zobristKey:int — the zobristed key for hash map.
|
| dump | () | method |
override public function dump():StringPrints out all elements (for debug/demo purposes).
ReturnsString — A human-readable representation of the structure.
|
| xor | () | method |
public function xor(anewTable:ZobristHashTable):ZobristHashTableParameters
anewTable:ZobristHashTable — to be xor-ed.
|
ZobristHashTable — after xoring anew zobrist hash table.
|