]> git.sesse.net Git - stockfish/commitdiff
Give bonus for bishops that are alligned with enemy kingring.
authorStefan Geschwentner <stgeschwentner@gmail.com>
Sun, 31 May 2020 15:00:47 +0000 (17:00 +0200)
committerJoost VandeVondele <Joost.VandeVondele@gmail.com>
Mon, 1 Jun 2020 15:35:02 +0000 (17:35 +0200)
Inspired by the succesful patch "Give bonus for rooks that are alligned with enemy kingring" from Vizvezdenec,
this idea has been reused for bishops. Here, we only consider attacks that are not blocked by any pawn.
Also we have a 50% higher bonus than for the rooks.

STC:
LLR: 2.94 (-2.94,2.94) {-0.50,1.50}
Total: 68960 W: 13495 L: 13202 D: 42263
Ptnml(0-2): 1213, 8018, 15802, 8157, 1290
https://tests.stockfishchess.org/tests/view/5ed27495042fa6d77c3553aa

LTC:
LLR: 2.96 (-2.94,2.94) {0.25,1.75}
Total: 54560 W: 7105 L: 6780 D: 40675
Ptnml(0-2): 379, 4986, 16254, 5253, 408
https://tests.stockfishchess.org/tests/view/5ed30375596e6dc1e1f97425

closes https://github.com/official-stockfish/Stockfish/pull/2708

Bench: 4860021

src/evaluate.cpp

index ad79db5c4dc30164e6fdf183e534725c1d368bee..dc7134a8818bdd6874ec555eeef935502a13eeaa 100644 (file)
@@ -128,6 +128,7 @@ namespace {
 
   // Assorted bonuses and penalties
   constexpr Score BishopPawns         = S(  3,  7);
 
   // Assorted bonuses and penalties
   constexpr Score BishopPawns         = S(  3,  7);
+  constexpr Score BishopOnKingRing    = S( 24,  0);
   constexpr Score BishopXRayPawns     = S(  4,  5);
   constexpr Score CorneredBishop      = S( 50, 50);
   constexpr Score FlankAttacks        = S(  8,  0);
   constexpr Score BishopXRayPawns     = S(  4,  5);
   constexpr Score CorneredBishop      = S( 50, 50);
   constexpr Score FlankAttacks        = S(  8,  0);
@@ -288,9 +289,13 @@ namespace {
             kingAttackersWeight[Us] += KingAttackWeights[Pt];
             kingAttacksCount[Us] += popcount(b & attackedBy[Them][KING]);
         }
             kingAttackersWeight[Us] += KingAttackWeights[Pt];
             kingAttacksCount[Us] += popcount(b & attackedBy[Them][KING]);
         }
+
         else if (Pt == ROOK && (file_bb(s) & kingRing[Them]))
             score += RookOnKingRing;
 
         else if (Pt == ROOK && (file_bb(s) & kingRing[Them]))
             score += RookOnKingRing;
 
+        else if (Pt == BISHOP && (attacks_bb<BISHOP>(s, pos.pieces(PAWN)) & kingRing[Them]))
+            score += BishopOnKingRing;
+
         int mob = popcount(b & mobilityArea[Us]);
 
         mobility[Us] += MobilityBonus[Pt - 2][mob];
         int mob = popcount(b & mobilityArea[Us]);
 
         mobility[Us] += MobilityBonus[Pt - 2][mob];