Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Crafty question about HashStorePV()

Author: Robert Hyatt

Date: 18:59:11 04/21/01

Go up one level in this thread


On April 21, 2001 at 17:57:19, Alvaro Jose Povoa Cardoso wrote:

>Could someone (namely Dr. Hyatt) explain to me (perhaps with pseudocode) the
>code below in HashStorePV()?

I will try:


If the hash keys match, _and_ this is not a "permanent hash entry" (AKA
position learning value) then I just stuff the PV move into this hash
entry to guide the search.  If it is a position learning entry, it probably
has a _better_ idea of the best move than we do here so I don't overwrite
that move.

>
>  if ((htablea->word2^htablea->word1) == temp_hashkey &&
>      (htablea->word1>>61)) {
>    htablea->word2=htablea->word2^htablea->word1;
>    htablea->word1&=~((BITBOARD) 07777777<<32);
>    htablea->word1|=(BITBOARD) tree->pv[ply].path[ply]<<32;
>    htablea->word2=htablea->word2^htablea->word1;
>  }

If we get here, the depth-preferred entry didn't match the key, or
else it was not overwritable (position learning).  We then check the
always-store entry to see if the key matches.  If so, I just insert the
PV move and leave everything else alone.



>  else if ((htableb->word2^htableb->word1) == temp_hashkey) {
>    htableb->word2=htableb->word2^htableb->word1;
>    htableb->word1&=~((BITBOARD) 07777777<<32);
>    htableb->word1|=(BITBOARD) tree->pv[ply].path[ply]<<32;
>    htableb->word2=htableb->word2^htableb->word1;
>  }


If I get here, the always-store entry didn't match.  I insert a complete
fake entry with type=USELESS (which means the score is no good) but I stuff
the PV move which will then do the right thing for move ordering.


>  else {
>    htableb->word1=(BITBOARD) 65536;
>    htableb->word1|=((BITBOARD) ((transposition_id<<2)+WORTHLESS))<<59;
>    htableb->word1|=(BITBOARD) tree->pv[ply].path[ply]<<32;
>    htableb->word2=temp_hashkey^htableb->word1;
>  }
>
>
>When storing a PV entry in the hash table, I can't figure out when to store in
>the _depth_priority_ table and when to store in the _always_store_ table and
>what exactly to store in every case.
>I'd particularly like to know what to store as _type_  and _draft_ in each and
>every case.
>
>Thank you
>
>Alvaro Cardoso


If the entry is already in either table, I just insert the PV move and leave
everything else alone.  If it is in neither, I put it in "always store" but
set the type to "USELESS" which says the score/bound is no good.  But the
best move is..

Hope that helps.  If not, let me know and I'll try again.



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.