]> git.sesse.net Git - stockfish/blobdiff - src/evaluate.cpp
Retire pawn storm evaluation
[stockfish] / src / evaluate.cpp
index 9ff554cde1f76fa1e400bc4b0b3974190e97c59c..72dc73a17c0da9e92679f4146d6ce0d063daa72b 100644 (file)
@@ -336,26 +336,11 @@ Value do_evaluate(const Position& pos, Value margins[]) {
 
   Phase phase = mi->game_phase();
 
-  // Middle-game specific evaluation terms
-  if (phase > PHASE_ENDGAME)
+  // Evaluate space for both sides, only in middle-game.
+  if (phase > PHASE_ENDGAME && mi->space_weight() > 0)
   {
-      // Evaluate pawn storms in positions with opposite castling
-      if (   square_file(pos.king_square(WHITE)) >= FILE_E
-          && square_file(pos.king_square(BLACK)) <= FILE_D)
-
-          bonus += make_score(ei.pi->queenside_storm_value(WHITE) - ei.pi->kingside_storm_value(BLACK), 0);
-
-      else if (   square_file(pos.king_square(WHITE)) <= FILE_D
-               && square_file(pos.king_square(BLACK)) >= FILE_E)
-
-          bonus += make_score(ei.pi->kingside_storm_value(WHITE) - ei.pi->queenside_storm_value(BLACK), 0);
-
-      // Evaluate space for both sides
-      if (mi->space_weight() > 0)
-      {
-          int s = evaluate_space<WHITE, HasPopCnt>(pos, ei) - evaluate_space<BLACK, HasPopCnt>(pos, ei);
-          bonus += apply_weight(make_score(s * mi->space_weight(), 0), Weights[Space]);
-      }
+      int s = evaluate_space<WHITE, HasPopCnt>(pos, ei) - evaluate_space<BLACK, HasPopCnt>(pos, ei);
+      bonus += apply_weight(make_score(s * mi->space_weight(), 0), Weights[Space]);
   }
 
   // If we don't already have an unusual scale factor, check for opposite
@@ -677,7 +662,7 @@ namespace {
     const Square ksq = pos.king_square(Us);
 
     // King shelter
-    Score bonus = ei.pi->king_shelter(pos, Us, ksq);
+    Score bonus = ei.pi->king_shelter<Us>(pos, ksq);
 
     // King safety. This is quite complicated, and is almost certainly far
     // from optimally tuned.
@@ -701,7 +686,7 @@ namespace {
         attackUnits =  Min(25, (ei.kingAttackersCount[Them] * ei.kingAttackersWeight[Them]) / 2)
                      + 3 * (ei.kingAdjacentZoneAttacksCount[Them] + count_1s_max_15<HasPopCnt>(undefended))
                      + InitKingDanger[relative_square(Us, ksq)]
-                     - mg_value(ei.pi->king_shelter(pos, Us, ksq)) / 32;
+                     - mg_value(ei.pi->king_shelter<Us>(pos, ksq)) / 32;
 
         // Analyse enemy's safe queen contact checks. First find undefended
         // squares around the king attacked by enemy queen...