Page 1 of 1

Issue with Perft(4) for Kiwipete position

PostPosted: 09 Aug 2014, 11:25
by Romain Goussault
Hi,

I am writing a chess Engine in Java => https://github.com/RomainGoussault/Deepov
I have tested the move generation with all the positions from the chessprogramming wiki perft page => https://chessprogramming.wikispaces.com/Perft+Results

They all work (for at least depth 4) except the Kiwipete position. FEN: r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R3K2R w KQkq -.
Depth 4 results do not match. I find 4 315 415 nodes and the correct value is 4 085 603.

I don't know where to look because the majority of the hard scenarios (castling, promotion, en passant) were tested on the other positions. I suspect it's something related with the black h3 pawn, because my programm outputs some errors for this pawn.

How to track down this bug?

Thanks

Re: Issue with Perft(4) for Kiwipete position

PostPosted: 09 Aug 2014, 20:14
by lazyguy123
You should print out all moves from the root, calculate perft(3) for each of those moves, and print out the result. This is known as perft divide.

Download sharper chess and run perft divide on sharper, and compare the results. If for example your program says h2h3 has 250,000 nodes and sharper says h2h3 has 260,000 nodes, you know that h2h3 is your problem. Make the move h2h3, print out all legal moves from the resulting position, and then run perft(2) on all legal moves. Repeat until you get to depth 1. That will allow you to isolate which moves are extra or missing.