I thought about checkmate by castling, but that shouldn't occur until a later ply.
If you don't have castling implemented and everything else is correct, you'll start getting wrong results at perft 7, as that is the first ply where the white king can castle. If you get errors before that, something else is wrong; often EP captures. Forgetting to set the EP-square, or to remove the pawn after the EP maneuver often happens. Your first EP-capture can already happen at ply 5. (1. e4, b6 | 2. e5, d5 : now d6 is an EP-square to where the e5 pawn can capture.)
Another problem with castling is forgetting to remove castling permissions when a rook is captured before it moves. (I forgot this as well, because I have never seen it happen in an over the board game; not even with beginners.)
mvanthoor wrote: ↑Wed Apr 15, 2020 8:05 pm
Another problem with castling is forgetting to remove castling permissions when a rook is captured before it moves. (I forgot this as well, because I have never seen it happen in an over the board game; not even with beginners.)
I solve that by maintaining a "dirty" BB, which is ORed with source and target bits on king and rook moves, and with target bits on all other moves, no branching required.
leanchess wrote: ↑Wed Apr 15, 2020 6:41 pmMy implementation detects either king captures or depth 0 checks. The former don't apply to superposition, while the latter account for all possible states.
And that's the problem because the super-imposition takes too many squares away which the move generator will regard as erroneously blocked (there's no actual piece that moves like queen and knight combined). Result will be missing moves from the opposite king. The basic thought mistake is that the super-imposition only collapses when that piece is moving while actually, it collapses right away when it's the opponent's turn because that's when the observation is being made already.
Ras wrote: ↑Wed Apr 15, 2020 9:18 pm
And that's the problem because the super-imposition takes too many squares away which the move generator will regard as erroneously blocked (there's no actual piece that moves like queen and knight combined).
You're giving too much credit to my move generator. It generates pseudolegal moves and thus has no notion of blocked squares. Instead, the king is simply "captured" following an illegal move, causing the function to return 0 (BTW I suspect the missing leaves have something to do with that logic).