Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: hashtable

Author: Jeff GAZET

Date: 07:55:37 05/11/04

Go up one level in this thread


>How many bits are you using for your hash key?  When you get
>a hit, do you check the entire key?
>Something like:
>
>         h_e = hash_table->getEntry(cp->getHashKey() & (hash_mask << 1));
>         if ((h_e->key ^ cp->getHashKey())==0) {
>               // get move from h_e
>               ...
>         }
>
>And finally: are you validating the move?
>--
>James

This is a 64 bits key.
I don't understand your code, i'm not used to bit operators.
Here is my code, at the beginning of alphabeta(), to get a hashtable score :

target=&pt_htable[g_hash%HASH_TABLE_SIZE];
if(ply && target->zkey==g_hash && target->depth>=depth)
	{
	switch(target->flags)
		{
		case hashfEXACT:	return target->eval;			break;
		case hashfALPHA:	if(target->eval<=alpha) {return alpha;} 	break;
		case hashfBETA:	if(target->eval>=beta) {return beta;}		break;
		}
	}

And the code to insert informations into the hashtable :

void TTableInsert(int depth, int eval, int hashflag)
	{
	hash_t *target = &pt_htable[g_hash % HASH_TABLE_SIZE];

	if(target->zkey==g_hash && target->depth>depth) {return;}

	target->zkey = g_hash;
	target->eval = eval;
	target->flags = hashflag;
	target->depth = depth;
	}



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.