X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fevaluate.cpp;h=ac9cf90bdcb314aad1198af283f0ab8d9662eb6c;hp=76ffcf039a65622a978520c0353e493801bcff59;hb=a4eda3056ef7f6f69ae15925255621cb32443de9;hpb=38471697b7e414f4509fb7dbf41f3f679711edb4 diff --git a/src/evaluate.cpp b/src/evaluate.cpp index 76ffcf03..ac9cf90b 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -540,6 +540,9 @@ 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 = weak & attackedBy[Us][ROOK]; @@ -549,9 +552,11 @@ namespace { 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; @@ -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]);