Merge official-stockfish/master
authorFabian Fichter <ianfab@users.noreply.github.com>
Sun, 20 Dec 2020 18:21:50 +0000 (19:21 +0100)
committerFabian Fichter <ianfab@users.noreply.github.com>
Sun, 20 Dec 2020 18:21:50 +0000 (19:21 +0100)
bench: 4173895

1  2 
README.md
src/evaluate.cpp
src/search.cpp

diff --cc README.md
Simple merge
@@@ -575,16 -484,28 +574,28 @@@ namespace 
  
          if (Pt == ROOK)
          {
-             // Bonus for rook on an open or semi-open file
+             // Bonuses for rook on a (semi-)open or closed file
              if (pos.is_on_semiopen_file(Us, s))
-                 score += RookOnFile[pos.is_on_semiopen_file(Them, s)];
-             // Penalty when trapped by the king, even more if the king cannot castle
-             else if (mob <= 3 && pos.count<KING>(Us))
              {
-                 File kf = file_of(pos.square<KING>(Us));
-                 if ((kf < FILE_E) == (file_of(s) < kf))
-                     score -= TrappedRook * (1 + !pos.castling_rights(Us));
+                 score += RookOnOpenFile[pos.is_on_semiopen_file(Them, s)];
+             }
+             else
+             {
+                 // If our pawn on this file is blocked, increase penalty
+                 if ( pos.pieces(Us, PAWN)
+                    & shift<Down>(pos.pieces())
+                    & file_bb(s))
+                 {
+                     score -= RookOnClosedFile;
+                 }
+                 // Penalty when trapped by the king, even more if the king cannot castle
 -                if (mob <= 3)
++                if (mob <= 3 && pos.count<KING>(Us))
+                 {
+                     File kf = file_of(pos.square<KING>(Us));
+                     if ((kf < FILE_E) == (file_of(s) < kf))
+                         score -= TrappedRook * (1 + !pos.castling_rights(Us));
+                 }
              }
          }
  
diff --cc src/search.cpp
Simple merge