@@ -31,59 +31,60 @@ namespace {
3131 #define V Value
3232 #define S (mg, eg ) make_score(mg, eg)
3333
34- // Doubled pawn penalty by file
35- const Score Doubled[FILE_NB] = {
36- S (13 , 43 ), S (20 , 48 ), S (23 , 48 ), S (23 , 48 ),
37- S (23 , 48 ), S (23 , 48 ), S (20 , 48 ), S (13 , 43 ) };
38-
3934 // Isolated pawn penalty by opposed flag and file
4035 const Score Isolated[2 ][FILE_NB] = {
41- { S (37 , 45 ), S (54 , 52 ), S (60 , 52 ), S (60 , 52 ),
42- S (60 , 52 ), S (60 , 52 ), S (54 , 52 ), S (37 , 45 ) },
43- { S (25 , 30 ), S (36 , 35 ), S (40 , 35 ), S (40 , 35 ),
44- S (40 , 35 ), S (40 , 35 ), S (36 , 35 ), S (25 , 30 ) } };
36+ { S (37 , 45 ), S (54 , 52 ), S (60 , 52 ), S (60 , 52 ),
37+ S (60 , 52 ), S (60 , 52 ), S (54 , 52 ), S (37 , 45 ) },
38+ { S (25 , 30 ), S (36 , 35 ), S (40 , 35 ), S (40 , 35 ),
39+ S (40 , 35 ), S (40 , 35 ), S (36 , 35 ), S (25 , 30 ) } };
4540
4641 // Backward pawn penalty by opposed flag
4742 const Score Backward[2 ] = { S (67 , 42 ), S (49 , 24 ) };
43+
44+ // Unsupported pawn penalty, for pawns which are neither isolated or backward
45+ const Score Unsupported = S(20 , 10 );
4846
4947 // Connected pawn bonus by opposed, phalanx, twice supported and rank
5048 Score Connected[2 ][2 ][2 ][RANK_NB];
49+
50+ // Doubled pawn penalty by file
51+ const Score Doubled[FILE_NB] = {
52+ S (13 , 43 ), S (20 , 48 ), S (23 , 48 ), S (23 , 48 ),
53+ S (23 , 48 ), S (23 , 48 ), S (20 , 48 ), S (13 , 43 ) };
5154
52- // Levers bonus by rank
55+ // Lever bonus by rank
5356 const Score Lever[RANK_NB] = {
54- S ( 0 , 0 ), S ( 0 , 0 ), S (0 , 0 ), S (0 , 0 ),
55- S (20 ,20 ), S (40 ,40 ), S (0 , 0 ), S (0 , 0 ) };
56-
57- // Unsupported pawn penalty
58- const Score UnsupportedPawnPenalty = S(20 , 10 );
57+ S ( 0 , 0 ), S ( 0 , 0 ), S (0 , 0 ), S (0 , 0 ),
58+ S (20 , 20 ), S (40 , 40 ), S (0 , 0 ), S (0 , 0 ) };
5959
60+ // Center bind bonus, when two pawns controls the same central square
6061 const Score CenterBind = S(16 , 0 );
6162
6263 // Weakness of our pawn shelter in front of the king by [distance from edge][rank]
6364 const Value ShelterWeakness[][RANK_NB] = {
64- { V ( 97 ), V (21 ), V (26 ), V (51 ), V (87 ), V ( 89 ), V ( 99 ) },
65- { V (120 ), V ( 0 ), V (28 ), V (76 ), V (88 ), V (103 ), V (104 ) },
66- { V (101 ), V ( 7 ), V (54 ), V (78 ), V (77 ), V ( 92 ), V (101 ) },
67- { V ( 80 ), V (11 ), V (44 ), V (68 ), V (87 ), V ( 90 ), V (119 ) } };
65+ { V ( 97 ), V (21 ), V (26 ), V (51 ), V (87 ), V ( 89 ), V ( 99 ) },
66+ { V (120 ), V ( 0 ), V (28 ), V (76 ), V (88 ), V (103 ), V (104 ) },
67+ { V (101 ), V ( 7 ), V (54 ), V (78 ), V (77 ), V ( 92 ), V (101 ) },
68+ { V ( 80 ), V (11 ), V (44 ), V (68 ), V (87 ), V ( 90 ), V (119 ) } };
6869
6970 // Danger of enemy pawns moving toward our king by [type][distance from edge][rank]
7071 const Value StormDanger[][4 ][RANK_NB] = {
71- { { V ( 0 ), V ( 67 ), V ( 134 ), V (38 ), V (32 ) },
72- { V ( 0 ), V ( 57 ), V ( 139 ), V (37 ), V (22 ) },
73- { V ( 0 ), V ( 43 ), V ( 115 ), V (43 ), V (27 ) },
74- { V ( 0 ), V ( 68 ), V ( 124 ), V (57 ), V (32 ) } },
75- { { V (20 ), V ( 43 ), V ( 100 ), V (56 ), V (20 ) },
76- { V (23 ), V ( 20 ), V ( 98 ), V (40 ), V (15 ) },
77- { V (23 ), V ( 39 ), V ( 103 ), V (36 ), V (18 ) },
78- { V (28 ), V ( 19 ), V ( 108 ), V (42 ), V (26 ) } },
79- { { V ( 0 ), V ( 0 ), V ( 75 ), V (14 ), V ( 2 ) },
80- { V ( 0 ), V ( 0 ), V ( 150 ), V (30 ), V ( 4 ) },
81- { V ( 0 ), V ( 0 ), V ( 160 ), V (22 ), V ( 5 ) },
82- { V ( 0 ), V ( 0 ), V ( 166 ), V (24 ), V (13 ) } },
83- { { V ( 0 ), V (-283 ), V (-281 ), V (57 ), V (31 ) },
84- { V ( 0 ), V ( 58 ), V ( 141 ), V (39 ), V (18 ) },
85- { V ( 0 ), V ( 65 ), V ( 142 ), V (48 ), V (32 ) },
86- { V ( 0 ), V ( 60 ), V ( 126 ), V (51 ), V (19 ) } } };
72+ { { V ( 0 ), V ( 67 ), V ( 134 ), V (38 ), V (32 ) },
73+ { V ( 0 ), V ( 57 ), V ( 139 ), V (37 ), V (22 ) },
74+ { V ( 0 ), V ( 43 ), V ( 115 ), V (43 ), V (27 ) },
75+ { V ( 0 ), V ( 68 ), V ( 124 ), V (57 ), V (32 ) } },
76+ { { V (20 ), V ( 43 ), V ( 100 ), V (56 ), V (20 ) },
77+ { V (23 ), V ( 20 ), V ( 98 ), V (40 ), V (15 ) },
78+ { V (23 ), V ( 39 ), V ( 103 ), V (36 ), V (18 ) },
79+ { V (28 ), V ( 19 ), V ( 108 ), V (42 ), V (26 ) } },
80+ { { V ( 0 ), V ( 0 ), V ( 75 ), V (14 ), V ( 2 ) },
81+ { V ( 0 ), V ( 0 ), V ( 150 ), V (30 ), V ( 4 ) },
82+ { V ( 0 ), V ( 0 ), V ( 160 ), V (22 ), V ( 5 ) },
83+ { V ( 0 ), V ( 0 ), V ( 166 ), V (24 ), V (13 ) } },
84+ { { V ( 0 ), V (-283 ), V (-281 ), V (57 ), V (31 ) },
85+ { V ( 0 ), V ( 58 ), V ( 141 ), V (39 ), V (18 ) },
86+ { V ( 0 ), V ( 65 ), V ( 142 ), V (48 ), V (32 ) },
87+ { V ( 0 ), V ( 60 ), V ( 126 ), V (51 ), V (19 ) } } };
8788
8889 // Max bonus for king safety. Corresponds to start position with all the pawns
8990 // in front of the king and no enemy pawn on the horizon.
@@ -167,7 +168,7 @@ namespace {
167168 assert (opposed | passed | (pawn_attack_span (Us, s) & theirPawns));
168169
169170 // Passed pawns will be properly scored in evaluation because we need
170- // full attack info to evaluate passed pawns . Only the frontmost passed
171+ // full attack info to evaluate them . Only the frontmost passed
171172 // pawn on each file is considered a true passed pawn.
172173 if (passed && !doubled)
173174 e->passedPawns [Us] |= s;
@@ -180,7 +181,7 @@ namespace {
180181 score -= Backward[opposed];
181182
182183 else if (!supported)
183- score -= UnsupportedPawnPenalty ;
184+ score -= Unsupported ;
184185
185186 if (connected)
186187 score += Connected[opposed][!!phalanx][more_than_one (supported)][relative_rank (Us, s)];
@@ -195,9 +196,8 @@ namespace {
195196 b = e->semiopenFiles [Us] ^ 0xFF ;
196197 e->pawnSpan [Us] = b ? int (msb (b) - lsb (b)) : 0 ;
197198
198- // Center binds: Two pawns controlling the same central square
199199 b = shift_bb<Right>(ourPawns) & shift_bb<Left>(ourPawns) & CenterBindMask;
200- score += popcount<Max15>(b) * CenterBind ;
200+ score += CenterBind * popcount<Max15>(b);
201201
202202 return score;
203203 }
0 commit comments