- // Outpost[knight/bishop][supported by pawn] contains bonuses for minor
- // pieces if they can reach an outpost square, bigger if that square is
- // supported by a pawn. If the minor piece occupies an outpost square
- // then score is doubled.
- const Score Outpost[][2] = {
- { S(22, 6), S(36,12) }, // Knight
- { S( 9, 2), S(15, 5) } // Bishop
- };
-
- // RookOnFile[semiopen/open] contains bonuses for each rook when there is no
- // friendly pawn on the rook file.
- const Score RookOnFile[] = { S(20, 7), S(45, 20) };
-
- // ThreatByMinor/ByRook[attacked PieceType] contains bonuses according to
- // which piece type attacks which one. Attacks on lesser pieces which are
- // pawn-defended are not considered.
- const Score ThreatByMinor[PIECE_TYPE_NB] = {
- S(0, 0), S(0, 33), S(45, 43), S(46, 47), S(72, 107), S(48, 118)
- };
-
- const Score ThreatByRook[PIECE_TYPE_NB] = {
- S(0, 0), S(0, 25), S(40, 62), S(40, 59), S(0, 34), S(35, 48)
- };
-
- // ThreatByKing[on one/on many] contains bonuses for king attacks on
- // pawns or pieces which are not pawn-defended.
- const Score ThreatByKing[] = { S(3, 62), S(9, 138) };
-
- // Passed[mg/eg][Rank] contains midgame and endgame bonuses for passed pawns.
- // We don't use a Score because we process the two components independently.
- const Value Passed[][RANK_NB] = {
- { V(0), V(5), V( 5), V(31), V(73), V(166), V(252) },
- { V(0), V(7), V(14), V(38), V(73), V(166), V(252) }
- };
-
- // PassedFile[File] contains a bonus according to the file of a passed pawn
- const Score PassedFile[FILE_NB] = {
- S( 9, 10), S( 2, 10), S( 1, -8), S(-20,-12),
- S(-20,-12), S( 1, -8), S( 2, 10), S( 9, 10)
- };
-
- // Rank factor applied on some bonus for passed pawn on rank 4 or beyond
- const int RankFactor[RANK_NB] = {0, 0, 0, 2, 6, 11, 16};
-
- // 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
-
- // KingAttackWeights[PieceType] contains king attack weights by piece type
- const int KingAttackWeights[PIECE_TYPE_NB] = { 0, 0, 78, 56, 45, 11 };
-
- // Penalties for enemy's safe checks
- const int QueenSafeCheck = 780;
- const int RookSafeCheck = 880;
- const int BishopSafeCheck = 435;
- const int KnightSafeCheck = 790;
-
- // Threshold for lazy and space evaluation
- const Value LazyThreshold = Value(1500);
- const Value SpaceThreshold = Value(12222);
-
-
- // initialize() computes king and pawn attacks, and the king ring bitboard
- // for a given color. This is done at the beginning of the evaluation.