From 6b354305e1ff27fcfa65c57ed92bd03160c3d5ca Mon Sep 17 00:00:00 2001 From: Ajith Date: Mon, 30 Jun 2014 10:55:10 -0400 Subject: [PATCH] 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 --- src/evaluate.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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] -- 2.39.2