Saturday, 24 March 2007

Solved in part

I finally found a part of the bug. In turns out that the "bishop" on c8 was actually a phantom king, caused by a faulty take-back of long castling. Running perft() again for the FEN string, "r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R3K2R w KQkq - 0 1", shows correct values up to perft(3). The values obtained were:

perft(1) 48 (correct)
perft(2) 2039 (correct)
perft(3) 97862 (correct)
perft(4) 4085659 (should be 4085603)
perft(5) 193696117 (should be 193690690)

Well at least the program is not hanging anymore. I don't know whether I should ignore this error for now or try and resolve it first. This little project turned out to be much harder than I thought!

3 comments:

Anonymous said...

The best thing you can do to track down perft bugs, is to get separate perft for each move from the start position, then compare them with those generated by a "proven" program. Usually one move will be off. Play that move and repeat. Takes a little bit of time, but this process will lead you straight to the move (or move sequence) that causes the error.

Anonymous said...

You will also find perft for that position separated by type here:
http://www.chessbox.de/Compu/schachzahl4_e.html

Sparky said...

Thank you for your suggestion. I finally gave in and wrote a divide method for Vicki and found the nasty bug!