- // Initialize the 'kingDanger' variable, which will be transformed
- // later into a king danger score. The initial value is based on the
- // number and types of the enemy's attacking pieces, the number of
- // attacked and weak squares around our king, the absence of queen and
- // the quality of the pawn shelter (current 'score' value).
- kingDanger = kingAttackersCount[Them] * kingAttackersWeight[Them]
- + 102 * kingAdjacentZoneAttacksCount[Them]
- + 191 * popcount(kingRing[Us] & weak)
- + 143 * bool(pos.pinned_pieces(Us))
- - 848 * !pos.count<QUEEN>(Them)
- - 9 * mg_value(score) / 8
- + 40;