X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fevaluate.cpp;h=ac9cf90bdcb314aad1198af283f0ab8d9662eb6c;hb=a4eda3056ef7f6f69ae15925255621cb32443de9;hp=95729e4aade6bea4d01a3fe776116aa91cc37c3d;hpb=0365b086017da2f5b0aeae6e396a213b56673c72;p=stockfish diff --git a/src/evaluate.cpp b/src/evaluate.cpp index 95729e4a..ac9cf90b 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -164,7 +164,7 @@ namespace { constexpr Score KnightOnQueen = S( 21, 11); constexpr Score LongDiagonalBishop = S( 22, 0); constexpr Score MinorBehindPawn = S( 16, 0); - constexpr Score Overload = S( 16, 7); + constexpr Score Overload = S( 13, 6); constexpr Score PawnlessFlank = S( 20, 80); constexpr Score RookOnPawn = S( 8, 24); constexpr Score SliderOnQueen = S( 42, 21); @@ -540,24 +540,29 @@ namespace { score += ThreatByMinor[type_of(pos.piece_on(s))]; if (type_of(pos.piece_on(s)) != PAWN) score += ThreatByRank * (int)relative_rank(Them, s); + + else if (pos.blockers_for_king(Them) & s) + score += ThreatByRank * (int)relative_rank(Them, s) / 2; } - b = (pos.pieces(Them, QUEEN) | weak) & attackedBy[Us][ROOK]; + b = weak & attackedBy[Us][ROOK]; while (b) { Square s = pop_lsb(&b); score += ThreatByRook[type_of(pos.piece_on(s))]; if (type_of(pos.piece_on(s)) != PAWN) score += ThreatByRank * (int)relative_rank(Them, s); + + else if (pos.blockers_for_king(Them) & s) + score += ThreatByRank * (int)relative_rank(Them, s) / 2; } - // Bonus for king attacks on pawns or pieces which are not pawn-defended if (weak & attackedBy[Us][KING]) score += ThreatByKing; score += Hanging * popcount(weak & ~attackedBy[Them][ALL_PIECES]); - b = weak & nonPawnEnemies & attackedBy[Them][ALL_PIECES]; + b = weak & nonPawnEnemies & attackedBy[Them][ALL_PIECES]; score += Overload * popcount(b); } @@ -576,7 +581,7 @@ namespace { b = shift(pos.pieces(Us, PAWN)) & ~pos.pieces(); b |= shift(b & TRank3BB) & ~pos.pieces(); - // Keep only the squares which are not completely unsafe + // Keep only the squares which are relatively safe b &= ~attackedBy[Them][PAWN] & (attackedBy[Us][ALL_PIECES] | ~attackedBy[Them][ALL_PIECES]);