]> git.sesse.net Git - stockfish/commitdiff
Replace the PassedDanger array by an equation
authorprotonspring <mike@whiteley.org>
Wed, 31 Oct 2018 15:05:44 +0000 (09:05 -0600)
committerStéphane Nicolet <cassio@free.fr>
Mon, 12 Nov 2018 19:33:07 +0000 (20:33 +0100)
This equation seems to do as well as the current PassedDanger array.

Master values were: 3, 7, 11, 20
The new values given by the equation are: 3, 6, 11, 18

STC:
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 84301 W: 18155 L: 18156 D: 47990
http://tests.stockfishchess.org/tests/view/5bda03180ebc595e0ae2518e

LTC:
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 7940 W: 1358 L: 1217 D: 5365
http://tests.stockfishchess.org/tests/view/5bdc69880ebc595e0ae27d28

We stopped a LTC run after 70000 games:
LLR: 0.74 (-2.94,2.94) [0.00,4.00]
Total: 70257 W: 11319 L: 11064 D: 47874
http://tests.stockfishchess.org/tests/view/5bdca8420ebc595e0ae281a9

Bench: 3913185

src/evaluate.cpp

index 6128b45fcad597e7c2ddad68f2ca4b55364f622d..0f89a05ac7767f9a7199e1ed543d986482307c5b 100644 (file)
@@ -151,9 +151,6 @@ namespace {
     S(-30,-14), S(-9, -8), S( 0,  9), S( -1,  7)
   };
 
     S(-30,-14), S(-9, -8), S( 0,  9), S( -1,  7)
   };
 
-  // PassedDanger[Rank] contains a term to weight the passed score
-  constexpr int PassedDanger[RANK_NB] = { 0, 0, 0, 3, 7, 11, 20 };
-
   // Assorted bonuses and penalties
   constexpr Score BishopPawns        = S(  3,  7);
   constexpr Score CloseEnemies       = S(  6,  0);
   // Assorted bonuses and penalties
   constexpr Score BishopPawns        = S(  3,  7);
   constexpr Score CloseEnemies       = S(  6,  0);
@@ -629,12 +626,12 @@ namespace {
         assert(!(pos.pieces(Them, PAWN) & forward_file_bb(Us, s + Up)));
 
         int r = relative_rank(Us, s);
         assert(!(pos.pieces(Them, PAWN) & forward_file_bb(Us, s + Up)));
 
         int r = relative_rank(Us, s);
-        int w = PassedDanger[r];
 
         Score bonus = PassedRank[r];
 
 
         Score bonus = PassedRank[r];
 
-        if (w)
+        if (r > RANK_3)
         {
         {
+            int w = (r-2) * (r-2) + 2;
             Square blockSq = s + Up;
 
             // Adjust bonus based on the king's proximity
             Square blockSq = s + Up;
 
             // Adjust bonus based on the king's proximity
@@ -675,7 +672,7 @@ namespace {
 
                 bonus += make_score(k * w, k * w);
             }
 
                 bonus += make_score(k * w, k * w);
             }
-        } // w != 0
+        } // rank > RANK_3
 
         // Scale down bonus for candidate passers which need more than one
         // pawn push to become passed, or have a pawn in front of them.
 
         // Scale down bonus for candidate passers which need more than one
         // pawn push to become passed, or have a pawn in front of them.