Wednesday, 21 March 2007

Move generation fixed!

The move generation seems to be fine now. I discovered more bugs than I thought I would. These included en-passant (ep) status flags that were not set correctly (allowing any piece to capture ep, which is very humorous!), castling which never updated the piece positions (in the lists), creating invisible phantom rooks and kings and numerous other weird and bugs.

I've run two perft tests for now. In both instances the correct move counts were obtained. I guess I need to do a few more, but I am both reluctant, scared and lazy. :-) I want Vicki to start playing chess! Here is the benchmarks so far (which still includes all the asserts). I am happy with the results - although, I don't have any idea if this is slow or fast. It's probably just okay.

For FEN-string:
"rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"

Up to perft(3), I got 0ms.
perft(4) 0.078s
perft(5) 1.687s
perft(6) 39.985s
perft(7) 17m 53.812s
perft(8) still running :-)

I also checked against the FEN-string
"n1n5/PPPk4/8/8/8/8/4Kppp/5N1N b - 0 1" to catch any promotion bugs. Fortunately, it checked out.

This should cover most move generation, make move and take back move scenarios. Next is a basic search function, to get Vicki to play its first valid chess game. I am still not sure what to actually release. The engine itself should be freeware and available to all, but I am not sure whether I want to release the source code - or is that sore code? ;-) I am open for suggestions, of course.

2 comments:

Jonatan Pettersson said...

Seems you have a tad faster move generation than Mediocre.

Of course you should release the source code! :) To me the open source works as motivator to keep things structured and always try solving things in simple (and hopefully fast) ways.

Also I've received many great tips from people that looked at my source.

Jaco van Niekerk said...

Well, at least your move generation is working (read my latest posting)!

...and your engine has an elo of 2100, my engine has a nice round elo of zero :)