]> git.sesse.net Git - stockfish/commitdiff
Scale down complexity for almost unwinnable endgames
authorVizvezdenec <Vizvezdenec@gmail.com>
Thu, 12 Sep 2019 03:43:04 +0000 (06:43 +0300)
committerStéphane Nicolet <cassio@free.fr>
Thu, 12 Sep 2019 08:33:18 +0000 (10:33 +0200)
This patch greatly scales down complexity of endgames when the
following conditions are all true together:

- pawns are all on one flank
- stronger side king is not outflanking weaker side
- no passed pawns are present

This should improve stockfish evaluation of obvious draws 4 vs 3, 3 vs 2
and 2 vs 1 pawns in rook/queen/knight/bishop single flank endgames where
strong side can not make progress.

passed STC
LLR: 2.94 (-2.94,2.94) [0.50,4.50]
Total: 15843 W: 3601 L: 3359 D: 8883

passed LTC
LLR: 2.96 (-2.94,2.94) [0.00,3.50]
Total: 121275 W: 20107 L: 19597 D: 81571

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

Bench: 3954190

==========================

How to continue from there?

a) This could be a powerful idea for refining some parts of the evaluation
   function, a bit like when we try quadratics or other equations to emphasize
   certain situations (xoto10).

b) Some other combinaison values for this bonus can be done further, or
   overall retuning of weight and offset while keeping the formula simple.

src/evaluate.cpp

index cb1ad1f420060ef6d7fa1e0b076f1a04ac3388b3..73e2144cc2d248faaf1fad03e08e43f6f3cb5870 100644 (file)
@@ -725,12 +725,17 @@ namespace {
     bool pawnsOnBothFlanks =   (pos.pieces(PAWN) & QueenSide)
                             && (pos.pieces(PAWN) & KingSide);
 
+    bool almostUnwinnable =   !pe->passed_count()
+                           &&  outflanking < 0
+                           && !pawnsOnBothFlanks;
+
     // Compute the initiative bonus for the attacking side
     int complexity =   9 * pe->passed_count()
                     + 11 * pos.count<PAWN>()
                     +  9 * outflanking
                     + 18 * pawnsOnBothFlanks
                     + 49 * !pos.non_pawn_material()
+                    - 36 * almostUnwinnable
                     -103 ;
 
     // Now apply the bonus: note that we find the attacking side by extracting