X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fevaluate.cpp;h=f17c575d2cfeb775a5c54afacf6875988becde80;hp=7fb3a8cb141d4294c969b8292b4e4ca3c288813b;hb=6b354305e1ff27fcfa65c57ed92bd03160c3d5ca;hpb=7ff865b924a5027ab3ecb5a6525ad165262fe3c2 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]