Do not consider quiet moves as attacks
authorFabian Fichter <ianfab@users.noreply.github.com>
Thu, 26 Sep 2019 18:46:32 +0000 (20:46 +0200)
committerFabian Fichter <ianfab@users.noreply.github.com>
Fri, 27 Sep 2019 06:18:34 +0000 (08:18 +0200)
Fix attack bitboard calculation for hoppelpoppel-style pieces.

hoppelpoppel STC
LLR: 2.94 (-2.94,2.94) [0.00,10.00]
Total: 863 W: 335 L: 247 D: 281
http://35.161.250.236:6543/tests/view/5d8d0ab36e23db3768ec085c

hoppelpoppel LTC
LLR: 2.96 (-2.94,2.94) [0.00,10.00]
Total: 717 W: 271 L: 187 D: 259
http://35.161.250.236:6543/tests/view/5d8d0d8f6e23db3768ec085f

chess STC
LLR: 3.00 (-2.94,2.94) [-10.00,5.00]
Total: 1338 W: 317 L: 279 D: 742
http://35.161.250.236:6543/tests/view/5d8d16766e23db3768ec0861

src/evaluate.cpp

index 03f6d49..bf4ac36 100644 (file)
@@ -297,8 +297,7 @@ namespace {
         // Find attacked squares, including x-ray attacks for bishops and rooks
         b = Pt == BISHOP ? attacks_bb<BISHOP>(s, pos.pieces() ^ pos.pieces(QUEEN))
           : Pt ==   ROOK ? attacks_bb<  ROOK>(s, pos.pieces() ^ pos.pieces(QUEEN) ^ pos.pieces(Us, ROOK))
-                         : (  (pos.attacks_from(Us, Pt, s) & pos.pieces())
-                            | (pos.moves_from(Us, Pt, s) & ~pos.pieces()));
+                         : pos.attacks_from(Us, Pt, s);
 
         // Restrict mobility to actual squares of board
         b &= pos.board_bb();
@@ -317,6 +316,9 @@ namespace {
             kingAttacksCount[Us] += popcount(b & attackedBy[Them][KING]);
         }
 
+        if (Pt > QUEEN)
+             b = (b & pos.pieces()) | (pos.moves_from(Us, Pt, s) & ~pos.pieces() & pos.board_bb());
+
         int mob = popcount(b & mobilityArea[Us]);
 
         if (Pt <= QUEEN)