Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Bug in craftys movegenerator?

Author: Ralph Stoesser

Date: 10:41:41 07/10/03

Go up one level in this thread


On July 10, 2003 at 06:56:10, Mikael Bäckman wrote:

>Hi,
>
>I've been tracking down problems with my engine, and found some oddities in
>updatíng the hashsignature after each move. Anyways, I thought "I wonder how
>crafty does it" and well, I think crafty does it wrong.
>
>Code from Crafty 19.3:
>
>  case king:
>    if (wtm) {
>      [snip]
>->    if (WhiteCastle(ply) > 0) {     <-
>        if (WhiteCastle(ply+1)&2) HashCastleW(1,HashKey);
>        if (WhiteCastle(ply+1)&1) HashCastleW(0,HashKey);
>        [snip]
>      }
>    }
>    else {
>      [snip]
>->    if (BlackCastle(ply+1) > 0) {   <- not the same ply as above?
>        if (BlackCastle(ply+1)&2) HashCastleB(1,HashKey);
>        if (BlackCastle(ply+1)&1) HashCastleB(0,HashKey);
>        [snip]
>      }
>    }
>    break;
>
>Since crafty knows how to castle the code obviously works, but it doesn't look
>right..
>
>Regards,
>Mikael

Should actually make no difference since tree->position[ply].w_castle has always
the same value as tree->position[ply+1].w_castle at this point. Look at the very
beginning of MakeMove, there you'll find

tree->position[ply+1]=tree->position[ply];

So it's not a real error, but nevertheless worth to correct because it looks
false on first view.

-Ralph



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.