Debug with PerfT

Code, algorithms, languages, construction...

Debug with PerfT

Postby xianmei » Tue May 30, 2017 2:49 pm

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
Posts: 2
Joined: Tue May 30, 2017 2:25 pm

Re: Debug with PerfT

Postby User923005 » Tue May 30, 2017 8:49 pm

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
Posts: 606
Joined: Thu May 19, 2011 1:35 am

Re: Debug with PerfT

Postby xianmei » Wed May 31, 2017 12:27 pm

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
Posts: 2
Joined: Tue May 30, 2017 2:25 pm

Return to Programming and Technical Discussions

Who is online

Users browsing this forum: No registered users and 2 guests