X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fevaluate.cpp;h=51cba651d5ef0088c912c79ca8ac622ce75a1eca;hp=27e1dd3d362a294ec49e20a1dc148b3454186342;hb=aa0166fba66d1bd3d2756f8f16b7f6161064d0a3;hpb=2bceba7f5162198834ca9f3dca0258e7eac1f797
diff --git a/src/evaluate.cpp b/src/evaluate.cpp
index 27e1dd3d..51cba651 100644
--- a/src/evaluate.cpp
+++ b/src/evaluate.cpp
@@ -18,7 +18,6 @@
along with this program. If not, see .
*/
-#include
#include
#include // For std::memset
#include
@@ -229,6 +228,8 @@ namespace {
const Square ksq = pos.square(Us);
+ Bitboard dblAttackByPawn = pawn_double_attacks_bb(pos.pieces(Us, PAWN));
+
// Find our pawns that are blocked or on the first two ranks
Bitboard b = pos.pieces(Us, PAWN) & (shift(pos.pieces()) | LowRanks);
@@ -240,7 +241,8 @@ namespace {
attackedBy[Us][KING] = pos.attacks_from(ksq);
attackedBy[Us][PAWN] = pe->pawn_attacks(Us);
attackedBy[Us][ALL_PIECES] = attackedBy[Us][KING] | attackedBy[Us][PAWN];
- attackedBy2[Us] = attackedBy[Us][KING] & attackedBy[Us][PAWN];
+ attackedBy2[Us] = (attackedBy[Us][KING] & attackedBy[Us][PAWN])
+ | dblAttackByPawn;
// Init our king safety tables
kingRing[Us] = attackedBy[Us][KING];
@@ -257,7 +259,7 @@ namespace {
kingAttacksCount[Them] = kingAttackersWeight[Them] = 0;
// Remove from kingRing[] the squares defended by two pawns
- kingRing[Us] &= ~pawn_double_attacks_bb(pos.pieces(Us, PAWN));
+ kingRing[Us] &= ~dblAttackByPawn;
}
@@ -743,12 +745,12 @@ namespace {
&& (pos.pieces(PAWN) & KingSide);
// Compute the initiative bonus for the attacking side
- int complexity = 9 * pe->pawn_asymmetry()
+ int complexity = 9 * pe->passed_count()
+ 11 * pos.count()
+ 9 * outflanking
+ 18 * pawnsOnBothFlanks
+ 49 * !pos.non_pawn_material()
- -121 ;
+ -103 ;
// Now apply the bonus: note that we find the attacking side by extracting
// the sign of the endgame value, and that we carefully cap the bonus so
@@ -776,7 +778,7 @@ namespace {
if ( pos.opposite_bishops()
&& pos.non_pawn_material(WHITE) == BishopValueMg
&& pos.non_pawn_material(BLACK) == BishopValueMg)
- sf = 8 + 4 * pe->pawn_asymmetry();
+ sf = 16 + 4 * pe->passed_count();
else
sf = std::min(40 + (pos.opposite_bishops() ? 2 : 7) * pos.count(strongSide), sf);