// which are attacked twice in that flank but not defended by our pawns.
kingFlank = KingFlank[file_of(ksq)];
b1 = attackedBy[Them][ALL_PIECES] & kingFlank & Camp;
- b2 = b1 & attackedBy2[Them] & ~attackedBy[Us][PAWN];
+ b2 = b1 & attackedBy2[Them];
int tropism = popcount(b1) + popcount(b2);
+ 4 * tropism
- 873 * !pos.count<QUEEN>(Them)
- 6 * mg_value(score) / 8
+ + mg_value(mobility[Them] - mobility[Us])
- 30;
// Transform the kingDanger units into a Score, and subtract it from the evaluation
if (kingDanger > 0)
- {
- int mobilityDanger = mg_value(mobility[Them] - mobility[Us]);
- kingDanger = std::max(0, kingDanger + mobilityDanger);
score -= make_score(kingDanger * kingDanger / 4096, kingDanger / 16);
- }
}
// Penalty when our king is on a pawnless flank