I'm in the process of writing a chess engine, and am currently working on the last tiny move generation bugs.
Thing is, using perft divide on positions found on https://www.chessprogramming.org/Perft_Results and comparing the results to Sharper, the results start becoming a bit off after depth 3-4.
After looking into it and scratching my head over what the cause could be, it seems that move generation does it's job as intended!
For example, in this position found after playing a2a4 e8g8 from Kiwipete ( r4rk1/p1ppqpb1/bn2pnp1/3PN3/Pp2P3/2N2Q1p/1PPBBPPP/R3K2R w KQ - 0 3):
movegen() outputs 49 moves,
using perftDivide() shows me 50 moves for e8g8,
Sharper perft divide function generates 49 moves for e8g8
I tried shoving off 1 node from the bulk counting, thinking the fact that a move stack of size 50 actually meant 49 moves got generated must have went over my head when writing the function. But for the same exact position, when looking at other moves, perft divide seemed to actually give correct move count.
Replacing e8g8 by b4b3 for example ( r3k2r/p1ppqpb1/bn2pnp1/3PN3/P3P3/1pN2Q1p/1PPBBPPP/R3K2R w KQkq - 0 3 ), Sharper, my perft divide function and the actual move generation all shared the same output of 49 moves.
I have no real idea what could cause this, and was wondering if anyone with a bit more experience/knowledge on the subject had maybe seen or encountered the same problem before ?
Thanks in advance for the help!
![Very Happy :D](./images/smilies/icon_e_biggrin.gif)