X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fevaluate.cpp;h=8987b0ecd0a72cc7337404f604ecb951b254e889;hp=434ebd6241249f21869fe6b6b58211a61febe325;hb=e7289465b9ecb2ab93b240285f8ab677eea86aeb;hpb=8ceb1ff53bf4b9aa9609d39f11bcb540a70ce4a5 diff --git a/src/evaluate.cpp b/src/evaluate.cpp index 434ebd62..8987b0ec 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -200,6 +200,7 @@ namespace { const Score Unstoppable = S( 0, 20); const Score PawnlessFlank = S(20, 80); const Score HinderPassedPawn = S( 7, 0); + const Score ThreatByRank = S(16, 3); // Penalty for a bishop on a1/h1 (a8/h8 for black) which is trapped by // a friendly pawn on b2/g2 (b7/g7 for black). This can obviously only @@ -561,11 +562,21 @@ namespace { { b = (defended | weak) & (ei.attackedBy[Us][KNIGHT] | ei.attackedBy[Us][BISHOP]); while (b) - score += Threat[Minor][type_of(pos.piece_on(pop_lsb(&b)))]; + { + Square s = pop_lsb(&b); + score += Threat[Minor][type_of(pos.piece_on(s))]; + if (type_of(pos.piece_on(s)) != PAWN) + score += ThreatByRank * (int)relative_rank(Them, s); + } b = (pos.pieces(Them, QUEEN) | weak) & ei.attackedBy[Us][ROOK]; while (b) - score += Threat[Rook ][type_of(pos.piece_on(pop_lsb(&b)))]; + { + Square s = pop_lsb(&b); + score += Threat[Rook][type_of(pos.piece_on(s))]; + if (type_of(pos.piece_on(s)) != PAWN) + score += ThreatByRank * (int)relative_rank(Them, s); + } score += Hanging * popcount(weak & ~ei.attackedBy[Them][ALL_PIECES]);