From 90b726ec00c4c15501112f204604495ee1e78984 Mon Sep 17 00:00:00 2001 From: Fabian Fichter Date: Mon, 4 Apr 2022 19:37:18 +0200 Subject: [PATCH] Fix quiet check move generation for mandatory piece promotions. --- src/movegen.cpp | 18 +++++++++--------- 1 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/movegen.cpp b/src/movegen.cpp index ed17247..57d647d 100644 --- a/src/movegen.cpp +++ b/src/movegen.cpp @@ -263,15 +263,6 @@ namespace { Bitboard b2 = promPt && (!pos.promotion_limit(promPt) || pos.promotion_limit(promPt) > pos.count(Us, promPt)) ? b1 : Bitboard(0); Bitboard b3 = pos.piece_demotion() && pos.is_promoted(from) ? b1 : Bitboard(0); - if (Checks) - { - b1 &= pos.check_squares(Pt); - if (b2) - b2 &= pos.check_squares(pos.promoted_piece_type(Pt)); - if (b3) - b3 &= pos.check_squares(type_of(pos.unpromoted_piece_on(from))); - } - // Restrict target squares considering promotion zone if (b2 | b3) { @@ -292,6 +283,15 @@ namespace { } } + if (Checks) + { + b1 &= pos.check_squares(Pt); + if (b2) + b2 &= pos.check_squares(pos.promoted_piece_type(Pt)); + if (b3) + b3 &= pos.check_squares(type_of(pos.unpromoted_piece_on(from))); + } + while (b1) moveList = make_move_and_gating(pos, moveList, Us, from, pop_lsb(b1)); -- 1.7.0.4