Tuesday, 31 July 2007

Test cases and transposition tables!

The test cases was a great idea and it paid off! I detected a problem with the Zobrist keys in that en-passant was not correctly added/removed. I also detected a nasty (and embarrassing) castling bug. I omitted the break-statement after each case-statement when verifying that the castling was valid. This means that if white wants to castle king-side, queen side castling must not move through check and white must not prevent black to castling either side, either! A very silly bug! I only detected it after adding a large series of perft checks to my test cases. By squashing this bug, my engine plays much better chess already!

Transposition tables is turning out to be very annoying! I keep on getting them "working" only to find that in a duel (100 games, 3 minutes per side, different starting positions) with the previous version that is does badly... or at best, just as good. Shouldn't transposition tables increase the ELO with 200+ points? As a result I've put this on ice for awhile.

In the WRCC tournament, my engine lost a particular game by means of a long capturing sequence that ended in a check. As checks are not part of the quiescence search, my engine never saw the pending disaster. I am thinking of ways to incorporate checks into the quiescence search without slowing things down too much. But how?

I'm also going to attempt to incorporate null moves into the engine. After reading up on the concept a few months ago I was most intrigued with the concept and it would be interesting to see what effect it will have on my engine.

1 comment:

Jonatan Pettersson said...

As I said before those transposition tables are a pain. :)

My best advice is first make sure the zobrist keys are handled correctly. Check keys manually (if you have a fixed random seed they will always be the same for the same position). And run many many different position to make sure everything is right.

Once you have the correct zobrist updates, close that section (i.e. making and unmaking moves for updating keys) and don't think about it anymore.

Now start testing different approaches to use the tables in the search. I tried 10 different approaches before it finally worked with the one I use now. Something as easy as a < instead of <= can make all your work in vain.

Hope you get it working soon, and don't give up.

(you should see a noticeable improvement when you get it right)