]> git.sesse.net Git - stockfish/commitdiff
Simplify trapped rook
authorMike Whiteley <mike@whiteley.org>
Thu, 15 Feb 2018 18:34:23 +0000 (19:34 +0100)
committerStéphane Nicolet <cassio@free.fr>
Thu, 15 Feb 2018 18:38:09 +0000 (19:38 +0100)
As far as can tell, semiopenFiles are set if there is a pawn anywhere on
the file. The removed condition would be true even if the pawns were very
advanced, which doesn't make sense if we're looking for a trapped rook.
Seems the engine fairs better with this removed. My guess s that the
condition that mobility is 3 or less does this well enough.

Begs the question whether this is a mobility issue alone... not sure.
Should I do LTC test?

STC
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 13377 W: 3009 L: 2871 D: 7497
http://tests.stockfishchess.org/tests/view/5a855be40ebc590297cc8166

Passed LTC
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 16288 W: 2813 L: 2685 D: 10790
http://tests.stockfishchess.org/tests/view/5a8575a80ebc590297cc817e

Bench: 5006365

src/evaluate.cpp
src/pawns.h

index 1c30a5ac5ee0e40258b9d43d52f84726b73ee129..c0c7e5ff7098c52b0493ea94693142b9898263db 100644 (file)
@@ -396,10 +396,9 @@ namespace {
             // Penalty when trapped by the king, even more if the king cannot castle
             else if (mob <= 3)
             {
-                Square ksq = pos.square<KING>(Us);
+                File kf = file_of(pos.square<KING>(Us));
 
-                if (   ((file_of(ksq) < FILE_E) == (file_of(s) < file_of(ksq)))
-                    && !pe->semiopen_side(Us, file_of(ksq), file_of(s) < file_of(ksq)))
+                if ((kf < FILE_E) == (file_of(s) < kf))
                     score -= (TrappedRook - make_score(mob * 22, 0)) * (1 + !pos.can_castle(Us));
             }
         }
index a9c21ffb1ef77a61e1bfce8c4db02fb6bf226aaa..669999bffda36a04e8eed44651f467af5136cfda 100644 (file)
@@ -45,10 +45,6 @@ struct Entry {
     return semiopenFiles[c] & (1 << f);
   }
 
-  int semiopen_side(Color c, File f, bool leftSide) const {
-    return semiopenFiles[c] & (leftSide ? (1 << f) - 1 : ~((1 << (f + 1)) - 1));
-  }
-
   int pawns_on_same_color_squares(Color c, Square s) const {
     return pawnsOnSquares[c][bool(DarkSquares & s)];
   }