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]