constexpr Score BishopPawns = S( 3, 7);
constexpr Score CloseEnemies = S( 6, 0);
constexpr Score CorneredBishop = S( 50, 50);
constexpr Score BishopPawns = S( 3, 7);
constexpr Score CloseEnemies = S( 6, 0);
constexpr Score CorneredBishop = S( 50, 50);
constexpr Score HinderPassedPawn = S( 8, 0);
constexpr Score KingProtector = S( 6, 6);
constexpr Score KnightOnQueen = S( 21, 11);
constexpr Score HinderPassedPawn = S( 8, 0);
constexpr Score KingProtector = S( 6, 6);
constexpr Score KnightOnQueen = S( 21, 11);
constexpr Score MinorBehindPawn = S( 16, 0);
constexpr Score Overload = S( 13, 6);
constexpr Score PawnlessFlank = S( 19, 84);
constexpr Score MinorBehindPawn = S( 16, 0);
constexpr Score Overload = S( 13, 6);
constexpr Score PawnlessFlank = S( 19, 84);
constexpr Score SliderOnQueen = S( 42, 21);
constexpr Score ThreatByKing = S( 23, 76);
constexpr Score ThreatByPawnPush = S( 45, 40);
constexpr Score SliderOnQueen = S( 42, 21);
constexpr Score ThreatByKing = S( 23, 76);
constexpr Score ThreatByPawnPush = S( 45, 40);
constexpr Color Them = (Us == WHITE ? BLACK : WHITE);
constexpr Bitboard SpaceMask =
Us == WHITE ? CenterFiles & (Rank2BB | Rank3BB | Rank4BB)
: CenterFiles & (Rank7BB | Rank6BB | Rank5BB);
constexpr Color Them = (Us == WHITE ? BLACK : WHITE);
constexpr Bitboard SpaceMask =
Us == WHITE ? CenterFiles & (Rank2BB | Rank3BB | Rank4BB)
: CenterFiles & (Rank7BB | Rank6BB | Rank5BB);
// Find the available squares for our pieces inside the area defined by SpaceMask
Bitboard safe = SpaceMask
& ~pos.pieces(Us, PAWN)
// Find the available squares for our pieces inside the area defined by SpaceMask
Bitboard safe = SpaceMask
& ~pos.pieces(Us, PAWN)
int outflanking = distance<File>(pos.square<KING>(WHITE), pos.square<KING>(BLACK))
- distance<Rank>(pos.square<KING>(WHITE), pos.square<KING>(BLACK));
int outflanking = distance<File>(pos.square<KING>(WHITE), pos.square<KING>(BLACK))
- distance<Rank>(pos.square<KING>(WHITE), pos.square<KING>(BLACK));
// 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
// 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