From 8154eeb510c43fca127c88faab71031d78fce73e Mon Sep 17 00:00:00 2001 From: Fabian Fichter Date: Mon, 4 May 2020 22:38:20 +0200 Subject: [PATCH] Consider Janggi cannon capture restrictions in SEE Closes #106. --- src/position.cpp | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/src/position.cpp b/src/position.cpp index 05e89b1..73698b2 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -743,6 +743,9 @@ Bitboard Position::slider_blockers(Bitboard sliders, Square s, Bitboard& pinners if (b && (!more_than_one(b) || ((AttackRiderTypes[type_of(piece_on(sniperSq))] & HOPPING_RIDERS) && popcount(b) == 2))) { + // Janggi cannons block each other + if ((pieces(JANGGI_CANNON) & sniperSq) && (pieces(JANGGI_CANNON) & blockers)) + blockers &= pieces(JANGGI_CANNON); blockers |= b; if (b & pieces(color_of(piece_on(s)))) pinners |= sniperSq; @@ -1718,6 +1721,10 @@ bool Position::see_ge(Move m, Value threshold) const { attackers |= attacks_bb(~stm, ROOK, to, occupied & ~pieces(ROOK)) & pieces(stm, KING); } + // Janggi cannons can not capture each other + if (type_of(moved_piece(m)) == JANGGI_CANNON && !(attackers & pieces(~stm) & ~pieces(JANGGI_CANNON))) + attackers &= ~pieces(~stm, JANGGI_CANNON); + while (true) { stm = ~stm; -- 1.7.0.4