// status of the players.
Score evaluate_initiative(const Position& pos, int asymmetry, Value eg) {
- int kingDistance = distance<File>(pos.square<KING>(WHITE), pos.square<KING>(BLACK));
+ int kingDistance = distance<File>(pos.square<KING>(WHITE), pos.square<KING>(BLACK))
+ - distance<Rank>(pos.square<KING>(WHITE), pos.square<KING>(BLACK));
int pawns = pos.count<PAWN>(WHITE) + pos.count<PAWN>(BLACK);
// Compute the initiative bonus for the attacking side
- int initiative = 8 * (pawns + asymmetry + kingDistance - 15);
+ int initiative = 8 * (asymmetry + kingDistance) + 12 * pawns - 120;
// Now apply the bonus: note that we find the attacking side by extracting
// the sign of the endgame value, and that we carefully cap the bonus so