- // 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 LongRangedBishop = S( 22, 0);
- const Score RookOnPawn = S( 8, 24);
- const Score TrappedRook = S( 92, 0);
- const Score WeakQueen = S( 50, 10);
- const Score CloseEnemies = S( 7, 0);
- const Score PawnlessFlank = S( 20, 80);
- const Score ThreatBySafePawn = S(192,175);
- const Score ThreatByRank = S( 16, 3);
- const Score Hanging = S( 48, 27);
- const Score WeakUnopposedPawn = S( 5, 25);
- const Score ThreatByPawnPush = S( 38, 22);
- const Score ThreatByAttackOnQueen = S( 38, 22);
- const Score HinderPassedPawn = S( 7, 0);
- const Score TrappedBishopA1H1 = S( 50, 50);
-
- #undef S
- #undef V
+ // PassedDanger[Rank] contains a term to weight the passed score
+ const int PassedDanger[RANK_NB] = { 0, 0, 0, 2, 7, 12, 19 };
+
+ // KingProtector[PieceType-2] contains a penalty according to distance from king
+ const Score KingProtector[] = { S(3, 5), S(4, 3), S(3, 0), S(1, -1) };
+
+ // Assorted bonuses and penalties
+ const Score BishopPawns = S( 8, 12);
+ const Score CloseEnemies = S( 7, 0);
+ const Score Hanging = S( 52, 30);
+ const Score HinderPassedPawn = S( 8, 1);
+ const Score LongRangedBishop = S( 22, 0);
+ const Score MinorBehindPawn = S( 16, 0);
+ const Score PawnlessFlank = S( 20, 80);
+ const Score RookOnPawn = S( 8, 24);
+ const Score ThreatByPawnPush = S( 47, 26);
+ const Score ThreatByRank = S( 16, 3);
+ const Score ThreatBySafePawn = S(175,168);
+ const Score ThreatOnQueen = S( 42, 21);
+ const Score TrappedBishopA1H1 = S( 50, 50);
+ const Score TrappedRook = S( 92, 0);
+ const Score WeakQueen = S( 50, 10);
+ const Score WeakUnopposedPawn = S( 5, 25);
+
+#undef S
+
+ // Evaluation class computes and stores attacks tables and other working data
+ template<Tracing T>
+ class Evaluation {