From c7d299f5340a4159dfa27b0a7b27712e5f3fac36 Mon Sep 17 00:00:00 2001 From: Fabian Fichter Date: Sun, 1 Dec 2019 19:14:32 +0100 Subject: [PATCH] Consider flying general rule in SEE Mitigates #59. --- src/position.cpp | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/src/position.cpp b/src/position.cpp index a673efb..5131555 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -1723,6 +1723,15 @@ bool Position::see_ge(Move m, Value threshold) const { Bitboard occupied = type_of(m) == DROP ? pieces() ^ to : pieces() ^ from ^ to; Bitboard attackers = attackers_to(to, occupied) & occupied; + // Flying general rule + if (var->flyingGeneral) + { + if (attackers & pieces(us, KING)) + attackers |= attacks_bb(us, ROOK, to, occupied & ~pieces(ROOK)) & pieces(~us, KING); + if (attackers & pieces(~us, KING)) + attackers |= attacks_bb(~us, ROOK, to, occupied & ~pieces(ROOK)) & pieces(us, KING); + } + while (true) { stmAttackers = attackers & pieces(stm); -- 1.7.0.4