Finding bugs in legal move generation or make/unmake move functions (Python)

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

eligolf
Posts: 114
Joined: Sat Nov 14, 2020 12:49 pm
Full name: Elias Nilsson

Re: Finding bugs in legal move generation or make/unmake move functions (Python)

Post by eligolf »

Ferdy, did you make that perft on my code? Because I fixed that and I get some strange results :)
Ferdy
Posts: 4833
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: Finding bugs in legal move generation or make/unmake move functions (Python)

Post by Ferdy »

eligolf wrote: Mon Nov 16, 2020 6:23 pm Ferdy, did you make that perft on my code? Because I fixed that and I get some strange results :)
Yes :)
eligolf
Posts: 114
Joined: Sat Nov 14, 2020 12:49 pm
Full name: Elias Nilsson

Re: Finding bugs in legal move generation or make/unmake move functions (Python)

Post by eligolf »

I reverted back to an older version of the code and made the switch, now it seems to be working perfect down to depth 5 from start position :D Thank you so much all for your valuable feedback, it will certainly be of use for future testing. And special gold star for Ferdy, you made my evening :)
alessandro
Posts: 49
Joined: Tue Aug 12, 2014 11:21 am
Location: Lund
Full name: Alessandro Iavicoli

Re: Finding bugs in legal move generation or make/unmake move functions (Python)

Post by alessandro »

Hi Elias,

I'm very happy to read that you're using the data from the Perft Result page in the wiki to test your move generator, because those numbers have been calculated by using AdaChess and that is my very small contribution to the community.
In the future version of the engine I am going to release those numbers also for the Divide function. This should help a bit more in finding bugs, for whom has interest on it. It could be that the wiki page for the Divide will be elaborated to provide this information.

Even if it is not the most important topic, sure it is a topic that every chess programmer soon or later has to deal with.
Although I agree with H.G.Muller that bugs are often in the Search, the perft is one of the few thing in chess programming that can be extensively tested and (i feel comfortable to say) almost proved for correctness. Once the move generator has been tested, you don't need to search anymore there for bugs and this will help in isolating the non-working code. Furthermore, it opens for future optimizations and code refining. Keep in mind that an engine spends normally 5-10% of the time in generating moves, so it's up to you to decide how much effort it worth to put on it.

I wish you the best for your chess engine and your graphical interface!
--
AdaChess - Smart Chess Engine - https://github.com/adachess/AdaChess

Image