Page 1 of 1

Debug with PerfT

PostPosted: Tue May 30, 2017 2:49 pm
by xianmei
I make an AI I made a lot of game on ( about 150 ) I have never encountered any problem ( illegal move ) I have 2000 elo on lichess but when I run a PerfT I obtain theses results :
1 : 20
2 : 400
3 : 8,902
4 : 197,281
5 : 4,865,867 <- problem should be 4,865,609 ( 4,865,609 + 258 en passant = 4,865,867 ?? )
6 : 119,072,421 <- problem should be 119,060,324

To determine legal move I make the move and if the king is check then I remove the move from list move
I implemented en passant, castling ( with rules ), promotions ...
I would like to know if there are several test which can isolate some probably problem
Thank you :D

Re: Debug with PerfT

PostPosted: Tue May 30, 2017 8:49 pm
by User923005
There are perft tests with things like 'divide' built into them that allow you to itemize.

Here is a thread about perft + divide. Stockfish will do this for you, so if you implement it for your engine, you can track down the branches that fail more easily. ... vide+perft

Here is a thread on debugging perft: ... vide+perft

Here is a place to get divide perft lists for huge trees: ... ght=divide

Re: Debug with PerfT

PostPosted: Wed May 31, 2017 12:27 pm
by xianmei
Thank you for your link , I used JetChess on your first link and I have been able to divide and determine my problem. I generate 2x each move En passant because of an "if" instead of "else if" so now I obtain the right result now
Thank you :D :D