Hi all
I've finally added transposition tables, history heuristics and bunch of other stuff to my engine. It clearly plays better, but I have a nasty bug that I just cannot pin down!
Vicki gets into a mate-in-x position, but instead of mating it goes into a draw by repetition. This only happens occasionally, which make me wonder if this isn't something to do with the transposition table?
Has anyone had this before?
Thanks
(Also, I'm having difficulty to post. I keep on getting:
Parse error: syntax error, unexpected T_BOOLEAN_AND in /usr/local/apache/htdocs/talkchess.com/forum/posting.php on line 505)
Nasty Vicki bug...
Moderator: Ras
-
- Posts: 28353
- Joined: Fri Mar 10, 2006 10:06 am
- Location: Amsterdam
- Full name: H G Muller
Re: Nasty Vicki bug...
It seems you do not handle mate scores consistently, so that storing them in the hash, and later retrieving them at another level in the tree, does produce a different score from when you would have found the same mate at that new place in the tree through search.
Re: Nasty Vicki bug...
There are basically two ways to solve this:hgm wrote:It seems you do not handle mate scores consistently, so that storing them in the hash, and later retrieving them at another level in the tree, does produce a different score from when you would have found the same mate at that new place in the tree through search.
- correct the score in the hashtable to be the distance to mate of the hashed position (instead of the root position) and correct it back to the distance to mate from the root when retrieving the score
- Don't bother about storing exact mate scores and just use a lower (or upper, depending on mating or being mated) bound for mates, e.g. lowerbound with mate in at most 1000 moves.
I've used the first method in the Baron, and use the second method now in CTD.
Richard.
Re: Nasty Vicki bug...
Thanks guys - I'll implmement this and hopefully I'll turn more of artificial draws into mates. The new version of Vicki may actually breech the 2000 elo level!
-
- Posts: 28353
- Joined: Fri Mar 10, 2006 10:06 am
- Location: Amsterdam
- Full name: H G Muller
Re: Nasty Vicki bug...
Actually my engines solve this through a delayed-loss bonus, which is different (and more general) from both methods you mention:pijl wrote:There are basically two ways to solve this:
- correct the score in the hashtable to be the distance to mate of the hashed position (instead of the root position) and correct it back to the distance to mate from the root when retrieving the score
- Don't bother about storing exact mate scores and just use a lower (or upper, depending on mating or being mated) bound for mates, e.g. lowerbound with mate in at most 1000 moves.
Code: Select all
Search(alpha, beta)
{
probeHash(); if(HIT) return(hash->score);
if(alpha < LOSS) alpha--;
if(beta <= LOSS) beta--;
bestScore = alpha; // for fail hard; you could also do fail soft.
for(ALL_MOVES)
{
score = - Search(-beta, -alpha);
if(score > bestScore) bestScore = score;
.... // usual alpha-beta stuff
}
if(bestScore < LOSS) bestScore++; // soften a loss if it occurs on your own move
storeHash(bestScore);
return bestScore;
}