]> git.sesse.net Git - stockfish/commitdiff
Remove ThreatByRank
authorprotonspring <mike@whiteley.org>
Mon, 30 Sep 2019 21:10:44 +0000 (15:10 -0600)
committerStéphane Nicolet <cassio@free.fr>
Tue, 1 Oct 2019 07:12:57 +0000 (09:12 +0200)
This is a functional simplification that removes ThreatByRank.

STC
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 48009 W: 10630 L: 10560 D: 26819
http://tests.stockfishchess.org/tests/view/5d92095c0ebc594fb88eb61e

LTC
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 18682 W: 3177 L: 3053 D: 12452
http://tests.stockfishchess.org/tests/view/5d9231120ebc594fb88ebacd

Moving forward, it's possible that ThreatByMinor and ThreatByRook
could be combined, but I haven't really contemplated that yet.

Closes https://github.com/official-stockfish/Stockfish/pull/2336

bench 4088701

src/evaluate.cpp
src/search.cpp

index 880aa1375badc42ceba8f89bf78541ad5e84f31d..fadc0fea43e9781e5245e3f5588845f044984171 100644 (file)
@@ -114,7 +114,7 @@ namespace {
   // which piece type attacks which one. Attacks on lesser pieces which are
   // pawn-defended are not considered.
   constexpr Score ThreatByMinor[PIECE_TYPE_NB] = {
-    S(0, 0), S(6, 28), S(39, 42), S(57, 44), S(68, 112), S(62, 120)
+    S(0, 0), S(6, 32), S(59, 41), S(79, 56), S(90, 119), S(79, 161)
   };
 
   constexpr Score ThreatByRook[PIECE_TYPE_NB] = {
@@ -143,7 +143,6 @@ namespace {
   constexpr Score SliderOnQueen      = S( 59, 18);
   constexpr Score ThreatByKing       = S( 24, 89);
   constexpr Score ThreatByPawnPush   = S( 48, 39);
-  constexpr Score ThreatByRank       = S( 13,  0);
   constexpr Score ThreatBySafePawn   = S(173, 94);
   constexpr Score TrappedRook        = S( 47,  4);
   constexpr Score WeakQueen          = S( 49, 15);
@@ -510,21 +509,11 @@ namespace {
     {
         b = (defended | weak) & (attackedBy[Us][KNIGHT] | attackedBy[Us][BISHOP]);
         while (b)
-        {
-            Square s = pop_lsb(&b);
-            score += ThreatByMinor[type_of(pos.piece_on(s))];
-            if (type_of(pos.piece_on(s)) != PAWN)
-                score += ThreatByRank * (int)relative_rank(Them, s);
-        }
+            score += ThreatByMinor[type_of(pos.piece_on(pop_lsb(&b)))];
 
         b = weak & attackedBy[Us][ROOK];
         while (b)
-        {
-            Square s = pop_lsb(&b);
-            score += ThreatByRook[type_of(pos.piece_on(s))];
-            if (type_of(pos.piece_on(s)) != PAWN)
-                score += ThreatByRank * (int)relative_rank(Them, s);
-        }
+            score += ThreatByRook[type_of(pos.piece_on(pop_lsb(&b)))];
 
         if (weak & attackedBy[Us][KING])
             score += ThreatByKing;
index 2ad535ccb56b93ce1690eff7e9d800df1f077d23..d34e182392843b4874a07b1b5858610a4e78a143 100644 (file)
@@ -1008,7 +1008,7 @@ moves_loop: // When in check, search starts from here
                && pos.advanced_pawn_push(move)
                && pos.pawn_passed(us, to_sq(move)))
           extension = ONE_PLY;
-          
+
       // Castling extension
       if (type_of(move) == CASTLING)
           extension = ONE_PLY;