Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Puzzled by my hashtable

Author: JW de Kort

Date: 11:18:38 01/08/03

Go up one level in this thread


On January 08, 2003 at 11:58:35, JW de Kort wrote:

>Hi Friends,
>
>I'am puzzled by the behaviour of my hashtable. I use 0x88 and at a certain piont
>the move B6-I3 is retrieved from this table. The strange thing is that this move
>cannot be generated and is also never stored in the table (i have checked this).
>Still it is retrieved. I'am completely puzzled by this.
>
>I know it is impossible to solve this kind problems without further information,
>but i know the hashtable is notorious for it's debugging so i hoped that some of
>you guys could give me a hint at what to look for.
>
>any help appreacited.
>
>Jan Willem


Thanks for the answers so far. May be my code for hashstore ans hashretrieve can
help you answer my question.

Here is my code:

/*------------------------------------------------------------------\
| HashStore slaat een zet op in de hashtable.                       |
\------------------------------------------------------------------*/
void  HashStore (int diepte, int waarde, int flag, int zetnr)
{	int StoreIndex;
	hash_key HashSleutel;

	/*--------------------------------------------------------------\
	| Calculate hash key                            |
	\--------------------------------------------------------------*/
	HashSleutel = hist_dat[zetnummer].hashsleutel;
	StoreIndex = HashSleutel & HASH_MASKER;

	/*--------------------------------------------------------------\
	| Sla de gegevens op. Voorlopig eenvoudig, zonder iets te       |
	| onderzoeken wordt de zet in de hashtable geknald.             |
	\--------------------------------------------------------------*/
	table[StoreIndex].z.i	= gen_dat[gen_begin[ply]+zetnr].m.i;
	table[StoreIndex].value	= waarde;
	table[StoreIndex].flag	= flag;
	table[StoreIndex].diepte= diepte;
	table[StoreIndex].lock = (int) HashSleutel>>32;
}

void HashRetrieve (int eigen)
{	int RetrieveIndex;
	hash_key HashSleutel;

	/*--------------------------------------------------------------\
	| Bepaald de index in de hashtable.                             |
	\--------------------------------------------------------------*/
	HashSleutel = hist_dat[zetnummer].hashsleutel;

	/*--------------------------------------------------------------\
	| Haal de gegevens op.                                          |
	\--------------------------------------------------------------*/
	HashTableDat[ply] = table[RetrieveIndex];

	/*--------------------------------------------------------------\
	| Analyseer de gevonden data.                                   |
	\--------------------------------------------------------------*/
	HashMoveFound[ply]=FALSE;
	SearchHashPoging++;

	if (HashTableDat[ply].lock == (int) hist_dat[movenummer].hashsleutel>>32)
	{	/*----------------------------------------------------------\
		| Chack for legal.                      |
		\----------------------------------------------------------*/
		if (legal(HashTableDat[ply].z.b.from, HashTableDat[ply].z.b.to,
					eigen, HashTableDat[ply].z.b.bits))
		{	HashMoveFound[ply]=HashTableDat[ply].z.b.bits;
			SearchHashLegaal++;
		}
		else // de zet  uit de hashtable is onjuist
		{	SearchHashIllegaal++;

	} // lock onjuist NIETS GEVONDEN
}


THis code mainly is in Dutch but i think it is understandeble to non-dutch
speakers as well.

thanks in advance

Jan WIllem






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.