Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Yet again: Hashing and FINE 70

Author: Tim Foden

Date: 03:32:32 12/19/00

Go up one level in this thread


On December 18, 2000 at 17:55:35, Thomas Mayer wrote:

>Hi Tim,
>>Agreed.  But GLC hangs *before* it sees the pawn win, let alone the
>>forced promotion.  I think it is an indicator that something is not
>>right.  I just don't have a clue what it is! :)
>>
>>Cheers, Tim.
>>

<quark output snipped>

>First thing I would try in your problem: take out any replacement rule and look
>if Green Light solves it... if yes, your hashing is allright and you should
>think if you should implement a second table...
>
>Greets, Thomas

I already have a 2 hash replacement scheme.  But thanks for the suggestion :)
Of course, I may have a bug in it (I have found a few in the past).

Just for interest, here is my store code:

//===========================================================================

inline void	CHashTable::Store(
	int			flags,
	int			value,
	int			depth,
	const CMove	moveToTry )
{
	UINT64	hash = CBoard::m_pState->m_hash;
	CHashTableRec**	pTable = m_pTable[CBoard::m_wtm];
	CHashTableRec*	pRec = &pTable[0][DWORD(hash) & m_sizeMask1];
	if( !pRec->IsInUse() )
	{
		// simply overwrite the record
		pRec->Set( hash, CHashTableRec::flagInUse | flags,
					value, depth, moveToTry );
		return;
	}

	if(	pRec->IsStale() || depth >= pRec->GetDepth() )
	{
		// if stale, or not stale and stored record is lower
		//	down the tree, then copy the old record to the
		//	secondary table, and then overwrite the record in the
		//	primary table.
		//
		// [remember, the depth value gets smaller further down tree
		// towards the leaves]
		DWORD	hash2 = DWORD(pRec->GetHash());
		CHashTableRec*	pRec2 = &pTable[1][hash2 & m_sizeMask2];
		*pRec2 = *pRec;
		pRec->Set( hash, CHashTableRec::flagInUse | flags,
					value, depth, moveToTry );
		return;
	}

	// just store in the secondary table
	pRec = &pTable[1][DWORD(hash) & m_sizeMask2];
	pRec->Set( hash, CHashTableRec::flagInUse | flags,
				value, depth, moveToTry );
}

//===========================================================================

Cheers, Tim.



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.