From: mbootsector Date: Fri, 25 Nov 2016 16:47:18 +0000 (+0100) Subject: Rank based threats X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=e7289465b9ecb2ab93b240285f8ab677eea86aeb;hp=8ceb1ff53bf4b9aa9609d39f11bcb540a70ce4a5 Rank based threats STC: LLR: 2.95 (-2.94,2.94) [0.00,5.00] Total: 19404 W: 3581 L: 3374 D: 12449 LTC: LLR: 2.96 (-2.94,2.94) [0.00,5.00] Total: 16204 W: 2194 L: 2023 D: 11987 Bench: 5757843 --- 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]);