]> git.sesse.net Git - stockfish/blobdiff - src/pawns.cpp
Re-add "Pawn Structure" UCI option
[stockfish] / src / pawns.cpp
index fca33f281a2bb69c6641d6f0c519b50a40c9dadf..3b04515f5f70889445bd2506449faac2ce599582 100644 (file)
@@ -62,8 +62,6 @@ namespace {
     S(34,68), S(83,166), S(0, 0), S( 0, 0)
   };
 
-  const Score PawnStructureWeight = S(233, 201);
-
   // Weakness of our pawn shelter in front of the king indexed by [king pawn][rank]
   const Value ShelterWeakness[2][RANK_NB] =
   { { V(141), V(0), V(38), V(102), V(128), V(141), V(141) },
@@ -176,6 +174,12 @@ namespace {
             value += CandidateBonus[relative_rank(Us, s)];
     }
 
+    e->pawnsOnSquares[Us][BLACK] = popcount<Max15>(ourPawns & BlackSquares);
+    e->pawnsOnSquares[Us][WHITE] = pos.piece_count(Us, PAWN) - e->pawnsOnSquares[Us][BLACK];
+
+    e->pawnsOnSquares[Them][BLACK] = popcount<Max15>(theirPawns & BlackSquares);
+    e->pawnsOnSquares[Them][WHITE] = pos.piece_count(Them, PAWN) - e->pawnsOnSquares[Them][BLACK];
+
     return value;
   }
 }
@@ -209,9 +213,6 @@ Entry* probe(const Position& pos, Table& entries) {
 
   e->value =  evaluate_pawns<WHITE>(pos, wPawns, bPawns, e)
             - evaluate_pawns<BLACK>(pos, bPawns, wPawns, e);
-
-  e->value = apply_weight(e->value, PawnStructureWeight);
-
   return e;
 }
 
@@ -231,7 +232,7 @@ Value Entry::shelter_storm(const Position& pos, Square ksq) {
   Rank rkUs, rkThem;
   File kf = file_of(ksq);
 
-  kf = (kf == FILE_A) ? kf++ : (kf == FILE_H) ? kf-- : kf;
+  kf = (kf == FILE_A) ? FILE_B : (kf == FILE_H) ? FILE_G : kf;
 
   for (int f = kf - 1; f <= kf + 1; f++)
   {