]> git.sesse.net Git - stockfish/commitdiff
Simplify and unify FRC cornered bishop.
authormstembera <MissingEmail@email>
Thu, 25 Mar 2021 20:33:05 +0000 (13:33 -0700)
committerJoost VandeVondele <Joost.VandeVondele@gmail.com>
Sat, 27 Mar 2021 16:03:10 +0000 (17:03 +0100)
tested locally as fishtest doesn't support FRC:

STC NNUE
9646 - 9647 - 20707 [0.500] 40000 -0.0 +/- 2.4, LOS: 49.7 %, DrawRatio: 51.8 %

STC classical
9678 - 9609 - 20713 [0.501] 40000 0.6 +/- 2.4, LOS: 69.0 %, DrawRatio: 51.8 %

and verified independently:

Score of master vs patch: 6463 - 6580 - 34957 [0.499] 48000

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

bench: 4321677

src/evaluate.cpp

index ca86a435fbfe9bd98318b1fe4d4bed468ca0f408..74f2e39bdf0d5d34bccf7cb8fd7542817ef8584c 100644 (file)
@@ -260,7 +260,8 @@ namespace {
   constexpr Score UncontestedOutpost  = S(  1, 10);
   constexpr Score BishopOnKingRing    = S( 24,  0);
   constexpr Score BishopXRayPawns     = S(  4,  5);
-  constexpr Score CorneredBishop      = S( 50, 50);
+  constexpr Value CorneredBishopV     = Value(50);
+  constexpr Score CorneredBishop      = S(CorneredBishopV, CorneredBishopV);
   constexpr Score FlankAttacks        = S(  8,  0);
   constexpr Score Hanging             = S( 69, 36);
   constexpr Score KnightOnQueen       = S( 16, 11);
@@ -477,9 +478,8 @@ namespace {
                 {
                     Direction d = pawn_push(Us) + (file_of(s) == FILE_A ? EAST : WEST);
                     if (pos.piece_on(s + d) == make_piece(Us, PAWN))
-                        score -= !pos.empty(s + d + pawn_push(Us))                ? CorneredBishop * 4
-                                : pos.piece_on(s + d + d) == make_piece(Us, PAWN) ? CorneredBishop * 2
-                                                                                  : CorneredBishop;
+                        score -= !pos.empty(s + d + pawn_push(Us)) ? CorneredBishop * 4
+                                                                   : CorneredBishop * 3;
                 }
             }
         }
@@ -1048,35 +1048,27 @@ make_v:
     if (!(pos.pieces(BISHOP) & Corners))
         return VALUE_ZERO;
 
-    constexpr int penalty1 = -209;
-    constexpr int penalty2 = -136;
-    constexpr int penalty3 = -148;
-
     int correction = 0;
 
     if (   pos.piece_on(SQ_A1) == W_BISHOP
         && pos.piece_on(SQ_B2) == W_PAWN)
-        correction += !pos.empty(SQ_B3)              ? penalty1
-                     : pos.piece_on(SQ_C3) == W_PAWN ? penalty2
-                                                     : penalty3;
+        correction += !pos.empty(SQ_B3) ? -CorneredBishopV * 4
+                                        : -CorneredBishopV * 3;
 
     if (   pos.piece_on(SQ_H1) == W_BISHOP
         && pos.piece_on(SQ_G2) == W_PAWN)
-        correction += !pos.empty(SQ_G3)              ? penalty1
-                     : pos.piece_on(SQ_F3) == W_PAWN ? penalty2
-                                                     : penalty3;
+        correction += !pos.empty(SQ_G3) ? -CorneredBishopV * 4
+                                        : -CorneredBishopV * 3;
 
     if (   pos.piece_on(SQ_A8) == B_BISHOP
         && pos.piece_on(SQ_B7) == B_PAWN)
-        correction += !pos.empty(SQ_B6)              ? -penalty1
-                     : pos.piece_on(SQ_C6) == B_PAWN ? -penalty2
-                                                     : -penalty3;
+        correction += !pos.empty(SQ_B6) ? CorneredBishopV * 4
+                                        : CorneredBishopV * 3;
 
     if (   pos.piece_on(SQ_H8) == B_BISHOP
         && pos.piece_on(SQ_G7) == B_PAWN)
-        correction += !pos.empty(SQ_G6)              ? -penalty1
-                     : pos.piece_on(SQ_F6) == B_PAWN ? -penalty2
-                                                     : -penalty3;
+        correction += !pos.empty(SQ_G6) ? CorneredBishopV * 4
+                                        : CorneredBishopV * 3;
 
     return pos.side_to_move() == WHITE ?  Value(correction)
                                        : -Value(correction);