]> git.sesse.net Git - stockfish/blobdiff - src/pawns.cpp
Fix inflate pawns.cpp fallout
[stockfish] / src / pawns.cpp
index 965d1ea387f47352fb5cb5773219cd6a01ef0c6d..a09fe68337d8aa7ab3bbbd5f93dc86023e901fc1 100644 (file)
@@ -244,15 +244,15 @@ PawnInfo *PawnInfoTable::get_pawn_info(const Position &pos) {
             // pawns on h6, g5, black pawns on h7, g6, f7).
 
             // Kingside and queenside pawn storms
-            bool outPost = (outpost_mask(us, s) & theirPawns);
-            bool passed = (passed_pawn_mask(us, s) & theirPawns);
             int KBonus = KStormTable[relative_square(us, s)];
             int QBonus = QStormTable[relative_square(us, s)];
+            bool outPost = (KBonus > 0 && (outpost_mask(us, s) & theirPawns));
+            bool passed = (QBonus > 0 && (passed_pawn_mask(us, s) & theirPawns));
 
             switch (f) {
 
             case FILE_A:
-                QBonus += passed * QBonus / 4;
+                QBonus += passed * QBonus / 2;
                 break;
 
             case FILE_B:
@@ -300,7 +300,7 @@ PawnInfo *PawnInfoTable::get_pawn_info(const Position &pos) {
             || isolated
             || chain
             || (pos.pawn_attacks(us, s) & theirPawns)
-            || (ourPawns & in_front_bb(them, r) & neighboring_files_bb(f)))
+            || (ourPawns & behind_bb(us, r) & neighboring_files_bb(f)))
             backward = false;
         else
         {
@@ -324,8 +324,8 @@ PawnInfo *PawnInfoTable::get_pawn_info(const Position &pos) {
         // Test for candidate passed pawn
         candidate =    !passed
                      && pos.file_is_half_open(them, f)
-                     && (  count_1s_max_15(neighboring_files_bb(f) & (in_front_bb(them, r) | rank_bb(r)) & ourPawns)
-                         - count_1s_max_15(neighboring_files_bb(f) &  in_front_bb(us, r)                 & theirPawns)
+                     && (  count_1s_max_15(neighboring_files_bb(f) & (behind_bb(us, r) | rank_bb(r)) & ourPawns)
+                         - count_1s_max_15(neighboring_files_bb(f) & in_front_bb(us, r)              & theirPawns)
                          >= 0);
 
         // In order to prevent doubled passed pawns from receiving a too big