Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Hashing is a complicated affair ?

Author: Sune Fischer

Date: 17:40:55 04/05/04

Go up one level in this thread


On April 05, 2004 at 19:58:00, rasjid chan wrote:

>On April 05, 2004 at 19:25:33, Sune Fischer wrote:
>
>If I am not wrong, this is what I am doing and my hashing SEEMS working
>ok. The PROBLEM is I make new discoveries every now and then.
>
>I understand hash table may have less bugs if we follow fail-hard
>ie NEVER FAIL OUTSIDE ALPHA OR BETA AND NEVER HASH OUTSIDE ALPHA
>BETA. But I have used fail soft without too much thought but simply
>because having a highest LB (> beta) or the lowest UB ( < alpha)
>seems appealing and trendy...
>
>I set a test question to see if most have the same answer.
>Assume we use fail soft and we use one TT for all nodes, hashing depth = 0
>for QS, other things as usual, if there is anything that may be assumed.
>
>We are in QS and not in-check and we have a few valid moves searched and
>let :-
>x = highest score of all the moves searched
>x < alpha
>
>We now want to hash and return from QS.
>
>Poser :- How do you hash this node and return.
>
>Thanks
>Rasjid

I don't hash qsearch, it slows me down about 15% and doesn't really trim the
tree so it's not worth it in my case.

Regardless, let's look at your question.

The example I posted was a probe into the table to get information out, this is
technically more difficult than what you want to do here which is recording
something into the table (well depends on replacement strategy of course).

I assume your code looks something like (forgetting about the standpat for
simplicity):

int qsearch(int a,int b) {
  int ao=a,s;

  gen_qmoves();
  while (moves) {
    make();
    s = -qsearch(-b,-a);
    unmake();
    if (s>=b) {
     Record(s,BETA_FLAG,0);
     return s;
    }
    a = max(a,s);
  }
  if (ao!=a)  Record(a,EXACT_FLAG,0);
  else  Record(a,ALPHA_FLAG,0);
  return a;
}

void Record(int score,int flag,int depth) {
  HASH_ENTRY *ht = &HashTable[key&0x000ffff..];

  ht->flag = flag;  // simple replace always scheme works ok
  ht->score = score;
  ht->depth = depth;

}

I actually record beta, I wonder if recording the softbound is better.

untested of course, hope i got most of it right.

-S.



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.