};
// Assorted bonuses and penalties
+ constexpr Score BadOutpost = S( -7, 36);
constexpr Score BishopOnKingRing = S( 24, 0);
constexpr Score BishopPawns = S( 3, 7);
constexpr Score BishopXRayPawns = S( 4, 5);
{
// Bonus if piece is on an outpost square or can reach one
bb = OutpostRanks & attackedBy[Us][PAWN] & ~pe->pawn_attacks_span(Them);
- if (bb & s)
+ if ( Pt == KNIGHT
+ && bb & s & ~CenterFiles
+ && !(b & pos.pieces(Them) & ~pos.pieces(PAWN))
+ && !conditional_more_than_two(
+ pos.pieces(Them) & ~pos.pieces(PAWN) & (s & QueenSide ? QueenSide : KingSide)))
+ score += BadOutpost;
+ else if (bb & s)
score += Outpost[Pt == BISHOP];
else if (Pt == KNIGHT && bb & b & ~pos.pieces(Us))
score += ReachableOutpost;