int kingFlankAttacks = popcount(b1) + popcount(b2);
kingDanger += kingAttackersCount[Them] * kingAttackersWeight[Them]
- + 69 * kingAttacksCount[Them]
+ 185 * popcount(kingRing[Us] & weak)
- - 100 * bool(attackedBy[Us][KNIGHT] & attackedBy[Us][KING])
- - 35 * bool(attackedBy[Us][BISHOP] & attackedBy[Us][KING])
+ 148 * popcount(unsafeChecks)
+ 98 * popcount(pos.blockers_for_king(Us))
+ + 69 * kingAttacksCount[Them]
+ + 3 * kingFlankAttacks * kingFlankAttacks / 8
+ + mg_value(mobility[Them] - mobility[Us])
- 873 * !pos.count<QUEEN>(Them)
+ - 100 * bool(attackedBy[Us][KNIGHT] & attackedBy[Us][KING])
+ - 35 * bool(attackedBy[Us][BISHOP] & attackedBy[Us][KING])
- 6 * mg_value(score) / 8
- + mg_value(mobility[Them] - mobility[Us])
- + 3 * kingFlankAttacks * kingFlankAttacks / 8
- 7;
// Transform the kingDanger units into a Score, and subtract it from the evaluation
assert(!(pos.pieces(Them, PAWN) & forward_file_bb(Us, s + Up)));
int r = relative_rank(Us, s);
- File f = file_of(s);
Score bonus = PassedRank[r];
|| (pos.pieces(PAWN) & (s + Up)))
bonus = bonus / 2;
- score += bonus - PassedFile * map_to_queenside(f);
+ score += bonus - PassedFile * map_to_queenside(file_of(s));
}
if (T)
else
sf = std::min(sf, 36 + (pos.opposite_bishops() ? 2 : 7) * pos.count<PAWN>(strongSide));
- sf = std::max(0, sf - (pos.rule50_count() - 12) / 4 );
+ sf = std::max(0, sf - (pos.rule50_count() - 12) / 4);
}
return ScaleFactor(sf);