Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: When do you probe pawn hash tables?

Author: Tim Foden

Date: 07:23:15 09/10/03

Go up one level in this thread


On September 10, 2003 at 10:04:24, Uri Blass wrote:

>On September 10, 2003 at 09:19:25, Tim Foden wrote:
>
>>Hi Uri,
>>
>>In GLC I probe the pawn hash tables every time Evaluate is called (it is probed
>>from withing the Evaluate code).  Evaluate is currently only called from the
>>q-search.
>>
>>Cheers, Tim.
>
>I still think that it is a waste of time and maybe it is better to keep a global
>varaible that tells me if to probe the pawn hash tables  only when make move
>does not change the pawn structure.
>
>At the end of makemove after I already decided if to probe or not to probe
>I should have
>HaveToProbe=0;
>
>In unmakemove I should have
>if (pawn structure was changed)
>HaveToProbe=1;
>
>When HaveToPtobe=0 in the beginning of makemove
>I can probe only when the pawn structure is changed and in other cases I
>alwaysprobe in makemove.
>
>Uri

Well, I guess it depends what you do whan you probe.

E.G. Given something like this (made up so I accept there could be bugs :)...

struct PawnHashRec
{
  unsigned __in64  m_pawnHash;

  // other fields in pawn hash record here...
};

static unsigned __int64  s_pawnHash;  // this is kept up-to-date my makemove()
static PawnHashRec       s_pawnProbe;
static PawnHashRec       s_pawnHashTable[PHASH_SIZE];

bool PawnHashLookup()
{
  int index = unsigned(s_pawnHash) % PHASH_SIZE;
  if( s_pawnHashTable[index].m_pawnHash != s_pawnHash )
    return false;

  s_pawnProbe = s_pawnHashTable[index];
  return true;
}

void PawnHashStore()
{
  int index = unsigned(s_pawnHash) % PHASH_SIZE;
  s_pawnHashTable[index].m_pawnHash = s_pawnProbe;
}

void AnalysePawns()
{
  s_pawnProbe.m_pawnHash = s_pawnHash;

  // do rest of pawn structure analysis here...
}
At the point where you want to probe can you do...

  if( s_pawnHash != s_pawnProbe.m_pawnHash )
  {
    if( !PawnHashLookup() )
    {
      AnalysePawns();
      PawnHashStore();
    }
  }

The (s_pawnHash != s_pawnProbe.m_pawnHash) basically tests the same condition as
your HaveToProbe, but it doesn't require any other code to be added to the
program (which you would need to keep HaveToProbe up-to-date).

Cheers, Tim.



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.