Jan 11, 2009

[Other] Bugs bugs bugs

The new Board-class of course had a bunch of more or less obvious bugs.

The last was a bug showed itself deep in the search trees (14 ply searches or more usually) and caused Mediocre to crash.

After 6 hours of bug-hunting I narrowed it down to pawn endings where one side had a pawn that still could move two steps.

Once found it was very obvious (and quite severe)... the zobrist key was updated according to where the en-passant-capturing pawn moved, and not to where the captured pawn actually was.

This caused faulty moves to be used in the search (from the hash move). Of course this didn't show up in the perft-checks since the zobrist was updated "correctly", just that the key was actually wrong.

Also it didn't show up until late in the trees (and usually in pawn endings) since the transposition table had to be quite full in order to moves actually existing in the faulty key-places.

-

Anyway, after some testing this new Board-class seems to offer a slight improvement in strenght. On to more interesting things.

1 comment:

Unknown said...

Thanks for this. I've been scratching my head trying to work out why my program crashes since using hashmove in move generation. I thought my transposition table was to blame but it was the exact same bug you mention. You saved me a lot of time.