]> git.sesse.net Git - stockfish/commitdiff
Move 50 moves counter to initiative.
authorStéphane Nicolet <cassio@free.fr>
Fri, 8 May 2020 08:32:52 +0000 (10:32 +0200)
committerJoost VandeVondele <Joost.VandeVondele@gmail.com>
Thu, 14 May 2020 18:34:15 +0000 (20:34 +0200)
simplify the usage of the 50 moves counter,
moving it frome the scale factor to initiative.

This patch was inspired by recent games where a blocked or semi-blocked position
was 'blundered', by moving a pawn, into a lost endgame. This patch improves this situation,
finding a more robust move more often.

for example (1s searches with many threads):
```
FEN 8/p3kp2/Pp2p3/1n2PpP1/5P2/1Kp5/8/R7 b - - 68 143

master:
      6 bestmove b5c7
      6 bestmove e7e8
     12 bestmove e7d8
    176 bestmove e7d7
patch:
      3 bestmove b5c7
      5 bestmove e7d8
    192 bestmove e7d7
```

fixes https://github.com/official-stockfish/Stockfish/issues/2620

the patch also tests well

passed STC
LLR: 2.94 (-2.94,2.94) {-1.50,0.50}
Total: 50168 W: 9508 L: 9392 D: 31268
Ptnml(0-2): 818, 5873, 11616, 5929, 848
https://tests.stockfishchess.org/tests/view/5ebb07287dd5693aad4e680b

passed LTC
LLR: 2.93 (-2.94,2.94) {-1.50,0.50}
Total: 7520 W: 981 L: 870 D: 5669
Ptnml(0-2): 49, 647, 2256, 760, 48
https://tests.stockfishchess.org/tests/view/5ebbff747dd5693aad4e6858

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

Bench: 4395562

src/evaluate.cpp

index e663f21f4497129984ebf86c72f0f5e4d7d24957..d972db5a1ccc26f178e962542c358a432a383073 100644 (file)
@@ -739,6 +739,7 @@ namespace {
                     + 24 * infiltration
                     + 51 * !pos.non_pawn_material()
                     - 43 * almostUnwinnable
+                    -  2 * pos.rule50_count()
                     -110 ;
 
     Value mg = mg_value(score);
@@ -778,8 +779,6 @@ namespace {
         }
         else
             sf = std::min(sf, 36 + 7 * pos.count<PAWN>(strongSide));
-
-        sf = std::max(0, sf - (pos.rule50_count() - 12) / 4);
     }
 
     return ScaleFactor(sf);
@@ -856,7 +855,8 @@ namespace {
         Trace::add(TOTAL, score);
     }
 
-    return  (pos.side_to_move() == WHITE ? v : -v) + Tempo; // Side to move point of view
+    // Side to move point of view
+    return (pos.side_to_move() == WHITE ? v : -v) + Tempo;
   }
 
 } // namespace