]> git.sesse.net Git - stockfish/commitdiff
Correct Outflanking calculations in classical eval
authorMoez Jellouli <37274752+MJZ1977@users.noreply.github.com>
Sun, 20 Dec 2020 21:28:23 +0000 (22:28 +0100)
committerJoost VandeVondele <Joost.VandeVondele@gmail.com>
Wed, 23 Dec 2020 19:20:24 +0000 (20:20 +0100)
Take signed value of rank difference between kings squares instead absolute value in outflanking calculation. This change correct evaluation of endgames with one king invading opponent last ranks.

Passed STC:
LLR: 2.94 (-2.94,2.94) {-0.25,1.25}
Total: 122240 W: 24326 L: 23896 D: 74018
Ptnml(0-2): 2101, 14139, 28236, 14517, 2127
https://tests.stockfishchess.org/tests/view/5fdfc33a3932f79192d394b8

Passed LTC:
LLR: 2.97 (-2.94,2.94) {0.25,1.25}
Total: 157416 W: 20870 L: 20292 D: 116254
Ptnml(0-2): 973, 13954, 48333, 14418, 1030
https://tests.stockfishchess.org/tests/view/5fe07a453932f79192d39502

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

Bench: 4162769

src/evaluate.cpp

index c945cf53345d05cda38c342734bf7a1156de4c7c..7671f6052df6050c7d2d21d84dcf173472658c5b 100644 (file)
@@ -867,7 +867,7 @@ namespace {
   Value Evaluation<T>::winnable(Score score) const {
 
     int outflanking =  distance<File>(pos.square<KING>(WHITE), pos.square<KING>(BLACK))
-                     - distance<Rank>(pos.square<KING>(WHITE), pos.square<KING>(BLACK));
+                    + int(rank_of(pos.square<KING>(WHITE)) - rank_of(pos.square<KING>(BLACK)));
 
     bool pawnsOnBothFlanks =   (pos.pieces(PAWN) & QueenSide)
                             && (pos.pieces(PAWN) & KingSide);