- // KingProtector[PieceType-2] contains a bonus according to distance from king
- const Score KingProtector[] = { S(-3, -5), S(-4, -3), S(-3, 0), S(-1, 1) };
-
- // Assorted bonuses and penalties used by evaluation
- const Score MinorBehindPawn = S( 16, 0);
- const Score BishopPawns = S( 8, 12);
- const Score RookOnPawn = S( 8, 24);
- const Score TrappedRook = S( 92, 0);
- const Score WeakQueen = S( 50, 10);
- const Score OtherCheck = S( 10, 10);
- const Score CloseEnemies = S( 7, 0);
- const Score PawnlessFlank = S( 20, 80);
- const Score ThreatByHangingPawn = S( 71, 61);
- const Score ThreatBySafePawn = S(182,175);
- const Score ThreatByRank = S( 16, 3);
- const Score Hanging = S( 48, 27);
- const Score ThreatByPawnPush = S( 38, 22);
- const Score HinderPassedPawn = S( 7, 0);
-
- // Penalty for a bishop on a1/h1 (a8/h8 for black) which is trapped by
- // a friendly pawn on b2/g2 (b7/g7 for black). This can obviously only
- // happen in Chess960 games.
- const Score TrappedBishopA1H1 = S(50, 50);
-
- #undef S
- #undef V
+ // PassedDanger[Rank] contains a term to weight the passed score
+ constexpr int PassedDanger[RANK_NB] = { 0, 0, 0, 3, 7, 11, 20 };
+
+ // Assorted bonuses and penalties
+ constexpr Score BishopPawns = S( 3, 7);
+ constexpr Score CloseEnemies = S( 6, 0);
+ constexpr Score CorneredBishop = S( 50, 50);
+ constexpr Score Hanging = S( 52, 30);
+ constexpr Score HinderPassedPawn = S( 4, 0);
+ constexpr Score KingProtector = S( 6, 6);
+ constexpr Score KnightOnQueen = S( 21, 11);
+ constexpr Score LongDiagonalBishop = S( 22, 0);
+ constexpr Score MinorBehindPawn = S( 16, 0);
+ constexpr Score Overload = S( 13, 6);
+ constexpr Score PawnlessFlank = S( 20, 80);
+ constexpr Score RookOnPawn = S( 8, 24);
+ constexpr Score SliderOnQueen = S( 42, 21);
+ constexpr Score ThreatByKing = S( 23, 76);
+ constexpr Score ThreatByPawnPush = S( 45, 40);
+ constexpr Score ThreatByRank = S( 16, 3);
+ constexpr Score ThreatBySafePawn = S(173,102);
+ constexpr Score TrappedRook = S( 92, 0);
+ constexpr Score WeakQueen = S( 50, 10);
+ constexpr Score WeakUnopposedPawn = S( 5, 29);
+
+#undef S
+
+ // Evaluation class computes and stores attacks tables and other working data
+ template<Tracing T>
+ class Evaluation {