]> git.sesse.net Git - stockfish/commitdiff
Don't increase mobility if attacked piece is defended by a pawn
authorMarco Costalba <mcostalba@gmail.com>
Wed, 30 Sep 2009 15:04:51 +0000 (16:04 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Sat, 3 Oct 2009 09:48:07 +0000 (10:48 +0100)
If an enemy piece is defended by a pawn don't give the
extra mobility bonus in case we attack it.

Joona says that "Paralyzing pawn" is usually worth of nothing.

On Joona QUAD after 964 games:
Orig - Patch_2: 191 - 218 - 555 (+ 10 elo)

On my PC after 999 games at 1+0:
Mod vs Orig +227 =550 -222 50.25%  502.0/999  +2 ELO

In both cases we tested against the original version (without
increased mobility), not against the previous patch that instead
seems to fail on Joona QUAD:
Orig vs. Prev.Patch: 237 - 217 - 627 (-6 elo)

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
src/evaluate.cpp

index 0bf64631c9d4a8686554619b43eb813c4c94de91..168b99614724fabf45c1b6ca3b06c4ad905ce71a 100644 (file)
@@ -550,16 +550,15 @@ namespace {
             ei.kingAdjacentZoneAttacksCount[Us] += count_1s_max_15<HasPopCnt>(bb);
     }
 
             ei.kingAdjacentZoneAttacksCount[Us] += count_1s_max_15<HasPopCnt>(bb);
     }
 
-    // The squares occupied by enemy pieces will be counted two times instead
-    // of one. The shift (almost) guarantees that intersection with b is zero
-    // so when we 'or' the two bitboards togheter and count we get the correct
-    // sum of '1' in b and attacked bitboards.
-    Bitboard attacked = Us == WHITE ? ((b & pos.pieces_of_color(Them)) >> 1)
-                                    : ((b & pos.pieces_of_color(Them)) << 1);
-
     // Remove squares protected by enemy pawns or occupied by our pieces
     b &= ~(ei.attackedBy[Them][PAWN] | pos.pieces_of_color(Us));
 
     // Remove squares protected by enemy pawns or occupied by our pieces
     b &= ~(ei.attackedBy[Them][PAWN] | pos.pieces_of_color(Us));
 
+    // The squares occupied by enemy pieces (not defended by pawns) will be
+    // counted two times instead of one. The shift (almost) guarantees that
+    // intersection with b is zero so when we 'or' the two bitboards togheter
+    // and count we get the correct sum of '1' in b and attacked bitboards.
+    Bitboard attacked = Us == WHITE ? ((b & pos.pieces_of_color(Them)) >> 1)
+                                    : ((b & pos.pieces_of_color(Them)) << 1);
     // Mobility
     int mob = (Piece != QUEEN ? count_1s_max_15<HasPopCnt>(b | attacked)
                               : count_1s<HasPopCnt>(b | attacked));
     // Mobility
     int mob = (Piece != QUEEN ? count_1s_max_15<HasPopCnt>(b | attacked)
                               : count_1s<HasPopCnt>(b | attacked));