]> git.sesse.net Git - stockfish/blobdiff - src/evaluate.cpp
Fix a bug in pawns eval tracing
[stockfish] / src / evaluate.cpp
index c9b2d31b0d42f1e5f61b2ee63b3e8ee65c69da8d..99e9f0475281111fff761ad0f4f0b0f33e7e3968 100644 (file)
@@ -494,16 +494,16 @@ Value do_evaluate(const Position& pos) {
         if (ei.attackedBy[Them][PAWN] & s)
             score -= ThreatenedByPawn[Pt];
 
-        // Penalty for bishop with same coloured pawns
-        if (Pt == BISHOP)
-            score -= BishopPawns * ei.pi->pawns_on_same_color_squares(Us, s);
-
-        // Penalty for knight when there are few enemy pawns
-        if (Pt == KNIGHT)
-            score -= KnightPawns * std::max(5 - pos.count<PAWN>(Them), 0);
-
         if (Pt == BISHOP || Pt == KNIGHT)
         {
+            // Penalty for bishop with same colored pawns
+            if (Pt == BISHOP)
+                score -= BishopPawns * ei.pi->pawns_on_same_color_squares(Us, s);
+
+            // Penalty for knight when there are few enemy pawns
+            if (Pt == KNIGHT)
+                score -= KnightPawns * std::max(5 - pos.count<PAWN>(Them), 0);
+
             // Bishop and knight outposts squares
             if (!(pos.pieces(Them, PAWN) & pawn_attack_span(Us, s)))
                 score += evaluate_outposts<Pt, Us>(pos, ei, s);
@@ -961,8 +961,8 @@ Value do_evaluate(const Position& pos) {
     switch (idx) {
     case PST: case IMBALANCE: case PAWN: case TOTAL:
         ss << std::setw(20) << name << " |   ---   --- |   ---   --- | "
-           << std::setw(6)  << to_cp(mg_value(wScore)) << " "
-           << std::setw(6)  << to_cp(eg_value(wScore)) << " \n";
+           << std::setw(6)  << to_cp(mg_value(wScore - bScore)) << " "
+           << std::setw(6)  << to_cp(eg_value(wScore - bScore)) << " \n";
         break;
     default:
         ss << std::setw(20) << name << " | " << std::noshowpos