@@ -142,32 +142,32 @@ namespace {
142142
143143 // ThreatByKing[on one/on many] contains bonuses for king attacks on
144144 // pawns or pieces which are not pawn-defended.
145- constexpr Score ThreatByKing[] = { S (25 , 57 ), S (4 , 139 ) };
145+ constexpr Score ThreatByKing[] = { S (30 , 62 ), S (- 9 , 160 ) };
146146
147147 // PassedRank[Rank] contains a bonus according to the rank of a passed pawn
148148 constexpr Score PassedRank[RANK_NB] = {
149- S (0 , 0 ), S (7 , 10 ), S (7 , 26 ), S (14 , 31 ), S (42 , 63 ), S (178 , 167 ), S (279 , 244 )
149+ S (0 , 0 ), S (4 , 17 ), S (7 , 20 ), S (14 , 36 ), S (42 , 62 ), S (165 , 171 ), S (279 , 252 )
150150 };
151151
152152 // PassedFile[File] contains a bonus according to the file of a passed pawn
153153 constexpr Score PassedFile[FILE_NB] = {
154- S ( 17 , 6 ), S (- 4 , 7 ), S ( 2 ,- 12 ), S (-17 ,- 14 ),
155- S (-17 ,- 14 ), S ( 2 ,- 12 ), S (- 4 , 7 ), S ( 17 , 6 )
154+ S ( 11 , 14 ), S ( 0 , - 5 ), S (- 2 , - 8 ), S (-25 ,- 13 ),
155+ S (-25 ,- 13 ), S (- 2 , - 8 ), S ( 0 , - 5 ), S ( 11 , 14 )
156156 };
157157
158158 // PassedDanger[Rank] contains a term to weight the passed score
159- constexpr int PassedDanger[RANK_NB] = { 0 , 0 , 0 , 3 , 6 , 12 , 21 };
159+ constexpr int PassedDanger[RANK_NB] = { 0 , 0 , 0 , 2 , 7 , 12 , 19 };
160160
161161 // KingProtector[PieceType-2] contains a penalty according to distance from king
162- constexpr Score KingProtector[] = { S (3 , 5 ), S (5 , 3 ), S (3 , 0 ), S (0 , -2 ) };
162+ constexpr Score KingProtector[] = { S (4 , 6 ), S (6 , 3 ), S (1 , 0 ), S (0 , -2 ) };
163163
164164 // Assorted bonuses and penalties
165165 constexpr Score BishopPawns = S( 3 , 5 );
166166 constexpr Score CloseEnemies = S( 8 , 0 );
167167 constexpr Score Connectivity = S( 3 , 1 );
168168 constexpr Score CorneredBishop = S( 50 , 50 );
169169 constexpr Score Hanging = S( 52 , 30 );
170- constexpr Score HinderPassedPawn = S( 5 , 2 );
170+ constexpr Score HinderPassedPawn = S( 5 , - 1 );
171171 constexpr Score KnightOnQueen = S( 21 , 11 );
172172 constexpr Score LongDiagonalBishop = S( 22 , 0 );
173173 constexpr Score MinorBehindPawn = S( 16 , 0 );
@@ -177,10 +177,10 @@ namespace {
177177 constexpr Score SliderOnQueen = S( 42 , 21 );
178178 constexpr Score ThreatByPawnPush = S( 49 , 30 );
179179 constexpr Score ThreatByRank = S( 16 , 3 );
180- constexpr Score ThreatBySafePawn = S(186 , 140 );
180+ constexpr Score ThreatBySafePawn = S(165 , 133 );
181181 constexpr Score TrappedRook = S( 92 , 0 );
182182 constexpr Score WeakQueen = S( 50 , 10 );
183- constexpr Score WeakUnopposedPawn = S( 14 , 19 );
183+ constexpr Score WeakUnopposedPawn = S( 5 , 26 );
184184
185185#undef S
186186
@@ -428,7 +428,7 @@ namespace {
428428 // Main king safety evaluation
429429 if (kingAttackersCount[Them] > 1 - pos.count <QUEEN>(Them))
430430 {
431- int kingDanger = - mg_value (score) ;
431+ int kingDanger = 0 ;
432432 unsafeChecks = 0 ;
433433
434434 // Attacked squares defended at most once by our queen or king
@@ -475,10 +475,11 @@ namespace {
475475
476476 kingDanger += kingAttackersCount[Them] * kingAttackersWeight[Them]
477477 + 64 * kingAttacksCount[Them]
478- + 182 * popcount (kingRing[Us] & weak)
479- + 128 * popcount (pos.blockers_for_king (Us) | unsafeChecks)
480- - 857 * !pos.count <QUEEN>(Them)
481- + 31 ;
478+ + 183 * popcount (kingRing[Us] & weak)
479+ + 122 * popcount (pos.blockers_for_king (Us) | unsafeChecks)
480+ - 860 * !pos.count <QUEEN>(Them)
481+ - 7 * mg_value (score) / 8
482+ + 17 ;
482483
483484 // Transform the kingDanger units into a Score, and subtract it from the evaluation
484485 if (kingDanger > 0 )
0 commit comments