- // Doubled pawn penalty by file
- const Score Doubled[FILE_NB] = {
- S(13, 43), S(20, 48), S(23, 48), S(23, 48),
- S(23, 48), S(23, 48), S(20, 48), S(13, 43) };
-
- // Isolated pawn penalty by opposed flag and file
- const Score Isolated[2][FILE_NB] = {
- { S(37, 45), S(54, 52), S(60, 52), S(60, 52),
- S(60, 52), S(60, 52), S(54, 52), S(37, 45) },
- { S(25, 30), S(36, 35), S(40, 35), S(40, 35),
- S(40, 35), S(40, 35), S(36, 35), S(25, 30) } };
-
- // Backward pawn penalty by opposed flag and file
- const Score Backward[2][FILE_NB] = {
- { S(30, 42), S(43, 46), S(49, 46), S(49, 46),
- S(49, 46), S(49, 46), S(43, 46), S(30, 42) },
- { S(20, 28), S(29, 31), S(33, 31), S(33, 31),
- S(33, 31), S(33, 31), S(29, 31), S(20, 28) } };
-
- // Connected pawn bonus by opposed, phalanx flags and rank
- Score Connected[2][2][RANK_NB];
-
- // Levers bonus by rank
- const Score Lever[RANK_NB] = {
- S( 0, 0), S( 0, 0), S(0, 0), S(0, 0),
- S(20,20), S(40,40), S(0, 0), S(0, 0) };
-
- // Unsupported pawn penalty
- const Score UnsupportedPawnPenalty = S(20, 10);
-
- // Weakness of our pawn shelter in front of the king by [distance from edge][rank]
- const Value ShelterWeakness[][RANK_NB] = {
- { V(100), V(13), V(24), V(64), V(89), V( 93), V(104) },
- { V(110), V( 1), V(29), V(75), V(96), V(102), V(107) },
- { V(102), V( 0), V(39), V(74), V(88), V(101), V( 98) },
- { V( 88), V( 4), V(33), V(67), V(92), V( 94), V(107) } };
-
- // Danger of enemy pawns moving toward our king by [type][distance from edge][rank]
+ // Isolated pawn penalty
+ const Score Isolated = S(13, 18);
+
+ // Backward pawn penalty
+ const Score Backward = S(24, 12);
+
+ // Connected pawn bonus by opposed, phalanx, #support and rank
+ Score Connected[2][2][3][RANK_NB];
+
+ // Doubled pawn penalty
+ const Score Doubled = S(18, 38);
+
+ // Weakness of our pawn shelter in front of the king by [isKingFile][distance from edge][rank].
+ // RANK_1 = 0 is used for files where we have no pawns or our pawn is behind our king.
+ const Value ShelterWeakness[][int(FILE_NB) / 2][RANK_NB] = {
+ { { V( 98), V(20), V(11), V(42), V( 83), V( 84), V(101) }, // Not On King file
+ { V(103), V( 8), V(33), V(86), V( 87), V(105), V(113) },
+ { V(100), V( 2), V(65), V(95), V( 59), V( 89), V(115) },
+ { V( 72), V( 6), V(52), V(74), V( 83), V( 84), V(112) } },
+ { { V(105), V(19), V( 3), V(27), V( 85), V( 93), V( 84) }, // On King file
+ { V(121), V( 7), V(33), V(95), V(112), V( 86), V( 72) },
+ { V(121), V(26), V(65), V(90), V( 65), V( 76), V(117) },
+ { V( 79), V( 0), V(45), V(65), V( 94), V( 92), V(105) } }
+ };
+
+ // Danger of enemy pawns moving toward our king by [type][distance from edge][rank].
+ // For the unopposed and unblocked cases, RANK_1 = 0 is used when opponent has
+ // no pawn on the given file, or their pawn is behind our king.