Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Simple hash tables programming question

Author: Robert Hyatt

Date: 07:37:00 09/15/00

Go up one level in this thread


On September 15, 2000 at 08:30:10, Jan Pernicka wrote:

> Hi,
>as I'm just fighting with hash tables in my program, my question is about it.
>
>Descriprion: My hash table(s) (HT) are in fact two: one for positions, where
>             white is on move and one where black is on move. This works OK
>             but...
>Problem: It's clear that one table will be much more occupied than second one
>         (because when you sketch the tree of the game to some depth (IE these
>          are positons possibly saved to HT) and label it's nodes as "white to
>          move" or "black to move", then one kind of them will be in greater
>          majority. So my model of HT is inefficient.
>Solution: 1) To have only one HT and with each saved position have a flag
>             indicating side to move.
>          2) To have (also) one HT and evry hashed positon (IE: that 32-bit
>             number in HT...) XOR with some (32-bit) constant depending on side
>             to move.

a simple idea is to simply complement the hash key when it is not a wtm
position.  Most machines can do this with a single instruction (for 32 bit
hash keys) or two instructions (for 64 bit keys).  This is what I do in Crafty
and Cray Blitz and it has always worked well.



>
>So, what is, please, commonly used technique (maybe:  3) ...   )
>
>  Thank you in advance
>
>     Jan



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.