From: Ajith Date: Mon, 30 Jun 2014 14:55:10 +0000 (-0400) Subject: Add bonuses for Minors attacking enemy pieces(except pawns) even when they are protec... X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=6b354305e1ff27fcfa65c57ed92bd03160c3d5ca Add bonuses for Minors attacking enemy pieces(except pawns) even when they are protected by enemy pawns. Patch passed STC LLR: 2.95 (-2.94,2.94) [-1.50,4.50] Total: 8206 W: 1426 L: 1304 D: 5476 and LTC LLR: 2.97 (-2.94,2.94) [0.00,6.00] Total: 19534 W: 2821 L: 2640 D: 14073 Bench: 9942172 --- diff --git a/src/evaluate.cpp b/src/evaluate.cpp index 7fb3a8cb..f17c575d 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -496,9 +496,17 @@ namespace { const Color Them = (Us == WHITE ? BLACK : WHITE); - Bitboard b, weakEnemies; + Bitboard b, weakEnemies, protectedEnemies; Score score = SCORE_ZERO; + // Protected enemies + protectedEnemies = (pos.pieces(Them) ^ pos.pieces(Them,PAWN)) + & ei.attackedBy[Them][PAWN] + & (ei.attackedBy[Us][KNIGHT] | ei.attackedBy[Us][BISHOP]); + + if(protectedEnemies) + score += Threat[0][type_of(pos.piece_on(lsb(protectedEnemies)))]; + // Enemies not defended by a pawn and under our attack weakEnemies = pos.pieces(Them) & ~ei.attackedBy[Them][PAWN]