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

Discussion of chess software programming and technical issues.

Moderators: hgm, Dann Corbit, Harvey Williamson

Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
eligolf
Posts: 57
Joined: Sat Nov 14, 2020 11:49 am
Full name: Elias Nilsson

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

Post by eligolf » Mon Nov 16, 2020 5:23 pm

Ferdy, did you make that perft on my code? Because I fixed that and I get some strange results :)

Ferdy
Posts: 4478
Joined: Sun Aug 10, 2008 1:15 pm
Location: Philippines

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

Post by Ferdy » Mon Nov 16, 2020 5:25 pm

eligolf wrote:
Mon Nov 16, 2020 5:23 pm
Ferdy, did you make that perft on my code? Because I fixed that and I get some strange results :)
Yes :)

eligolf
Posts: 57
Joined: Sat Nov 14, 2020 11:49 am
Full name: Elias Nilsson

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

Post by eligolf » Mon Nov 16, 2020 5:31 pm

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: 28
Joined: Tue Aug 12, 2014 9:21 am
Location: Oldenburg
Full name: Alessandro Iavicoli
Contact:

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

Post by alessandro » Wed Dec 09, 2020 3:37 pm

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!
--
Have a look at AdaChess - https://www.adachess.com

Image

Post Reply