Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Hash table insert

Author: Jeff GAZET

Date: 06:17:14 05/09/04

Go up one level in this thread


>>>>Hi,
>>>>
>>>>in theory, when adding informations into the transposition table :
>>>>If the hash is found in the TT, we update informations if TTDepth<=depth.
>>>>If the hash is not found, we add the new entry.
>>>>
>>>>So this could be written like this :
>>>>
>>>>if(target->zkey==g_hash && target->depth<=depth)
>>>>	{
>>>>	//target->zkey = g_hash;
>>>>	target->eval = eval;
>>>>	target->flags = hashflag;
>>>>	target->depth = depth;
>>>>	target->m = m;
>>>>	}
>>>>
>>>>// New entry
>>>>else
>>>>	{
>>>>	target->zkey = g_hash;
>>>>	target->eval = eval;
>>>>	target->flags = hashflag;
>>>>	target->depth = depth;
>>>>	target->m = m;
>>>>	}
>>>>
>>>>My question is that in both cases, the same thing is done ! :-)
>>>>And this must be wrong.
>>
>>>You should add the new entry only if its depth is >= the depth of the previous
>>>entry that you are about to overwrite.
>>>Rémi
>>
>>But if this is a new entry, there isn't any previous one ?
>
>if (target->zkey == g_hash) {
> if (target->depth > depth)
>  return;
>}
>
>target->zkey = g_hash;
>target->eval = eval;
>target->flags = hashflag;
>target->depth = depth;
>target->m = m;

Thanks, but i wrote : if (target->zkey!=g_hash && target->depth>depth) {return;}
Because we update only if target->zkey==g_hash and depth>=target->depth:
<=>  (target->zkey==g_hash && depth >= target->depth)
So we must return if :
!(target->zkey==g_hash && depth >= target->depth)
<=> (target->zkey!=g_hash && target->depth>depth)
(>= becomes > because we mustn't quit if target->depth=depth)



This page took 0.01 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.