constexpr Color Them = (Us == WHITE ? BLACK : WHITE);
constexpr Direction Up = (Us == WHITE ? NORTH : SOUTH);
- Bitboard neighbours, stoppers, doubled, support, phalanx;
+ Bitboard neighbours, stoppers, support, phalanx;
Bitboard lever, leverPush;
Square s;
- bool opposed, backward, passed;
+ bool opposed, backward, passed, doubled;
Score score = SCORE_ZERO;
const Square* pl = pos.squares<PAWN>(Us);
}
else if (!neighbours)
- score -= Isolated + WeakUnopposed * int(!opposed);
+ score -= Isolated + WeakUnopposed * !opposed;
else if (backward)
- score -= Backward + WeakUnopposed * int(!opposed);
+ score -= Backward + WeakUnopposed * !opposed;
- if (doubled && !support)
- score -= Doubled;
+ if (!support)
+ score -= Doubled * doubled
+ + WeakLever * more_than_one(lever);
}
- // Penalize our unsupported pawns attacked twice by enemy pawns
- score -= WeakLever * popcount( ourPawns
- & doubleAttackThem
- & ~e->pawnAttacks[Us]);
-
return score;
}
return result;
}
+/// Multiplication of a Score by an boolean
+inline Score operator*(Score s, bool b) {
+ return Score(int(s) * int(b));
+}
+
constexpr Color operator~(Color c) {
return Color(c ^ BLACK); // Toggle color
}