Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: hashtable

Author: Robert Hyatt

Date: 08:58:55 05/11/04

Go up one level in this thread


On May 11, 2004 at 09:55:42, Jeff GAZET wrote:

>>On May 11, 2004 at 05:54:52, Jeff GAZET wrote:
>>
>>>Good morning,
>>>
>>>i have some questions about the move to add into the hashtable (see code).
>>>When doing a null move, i don't know which move to insert ?
>>>At the end of the search() function, the "bestmove" can be null. So in
>>>TTableInsert(), if the move is NULL, we should return immediatly ?
>>>
>>>And another question: the score added to the hashtable depends on the side to
>>>move, so we should use 2 transpositions tables ? or returning +-score ?
>>>
>>>Thanks.
>>>
>>>search(...)
>>>	{
>>>	bestmove=NULL;
>>>	...
>>>	if(it's all right for a null move)
>>>		{
>>>		do_nullmove();
>>>
>>>		if(depth-R<1) {eval=-quiesce(-beta,-beta+1);}
>>>		else {eval=-search(depth-R-1,-beta,-beta+1,false);}
>>>
>>>		undo_nullmove();
>>>
>>>		if(eval>=beta)
>>>			{
>>>			// what should be bestmove here ? as bestmove is NULL actually
>>>			TTableInsert(depth, eval, hashfBETA,bestmove);
>>
>>
>>That seems very wrong to me.  I don't even do inserts after null
>>moves (not sure why; maybe I just haven't tried it).  You just
>>did a search to a reduced depth (R), so 'eval' represents the score
>>returned by that reduced search.  Storing the current position
>>with 'depth' will break things I think.
>>
>>On your original question: why store a move at all?
>
>To sort moves. But i'll see that later, i no longer add a move actually to the
>transposition table. But i still have a something strange :
>If i clear the hash table before each search(), moves played are all right.
>Otherwise, moves are bad.
>Do we need a table for each side ?

No.  But you _must_ account for side to move in the hash signature.  Same
position can occur with either black or white to move.  You can't mess that up.

>
>> If you
>>don't have one, just don't insert one.  Later, if you get a
>>hash hit, you'll have bounding information w/o a move to try.
>>
>>--
>>James
>>
>>
>>
>>>			return eval;
>>>			}
>>>		}
>>>	...
>>>	for(each move)
>>>		{
>>>		domove(themove);
>>>		eval=-alphabeta(depth-1,-beta,-alpha,true);
>>>		undomove();
>>>		if(eval>alpha)
>>>			{
>>>			bestmove=themove;
>>>			if(eval>=beta)
>>>				{
>>>				// bestmove!=NULL here
>>>				TTableInsert(depth, eval, hashfBETA,bestmove);
>>>				return eval;
>>>				}
>>>
>>>			alpha=eval;
>>>			}
>>>		}
>>>
>>>	// bestmove can be NULL here or can be the last "bestmove" found in for(each
>>>move)
>>>	TTableInsert(depth, alpha, (alpha<=orig_alpha)?hashfALPHA:hashfEXACT,bestmove);
>>>
>>>	return alpha;
>>>	}



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.