Currently Zahak generates fully legal moves. For every move at move generation
time:
- Movegen plays them
- checks if it is in-check or gives check
- Rejects moves that exposes king
- Tags check moves with (Check), which is then used in search to know if position is in check
- The check tag is also used for move-ordering (after killer and history moves, I prefer check moves).
- Note that, in this approach I play EVERY pseudo-legal move at least ONCE, and every legal move at most TWICE (at move gen time, and search time)
I changed this to:
- Movegen generates pseudo legal moves
- Sends them all to search (move-picker)
- Search plays them, and rejects illegal ones, accepts legal ones
- ONLY the moves that are actually searched are played (moves played at most ONCE)
- I do not and CANNOT use (check) for move-ordering. As I no longer have the info prior to search
The second approach, while makes for a much better NPS, but fails in the depth test. As my engine really enjoys the current move ordering. Anybody has experience with this? I probably need to find a more efficient way to find legal moves at movegen time, and tag moves with Check at the same time. But so far, all the approaches that I have seen are super complex for discovered checks
