@@ -142,45 +142,45 @@ 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 (3 , 65 ), S (9 , 145 ) };
145+ constexpr Score ThreatByKing[] = { S (25 , 57 ), S (4 , 139 ) };
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 (5 , 7 ), S (5 , 13 ), S (18 , 23 ), S (74 , 58 ), S (164 , 166 ), S (268 , 243 )
149+ S (0 , 0 ), S (7 , 10 ), S (7 , 26 ), S (14 , 31 ), S (42 , 63 ), S (178 , 167 ), S (279 , 244 )
150150 };
151151
152152 // PassedFile[File] contains a bonus according to the file of a passed pawn
153153 constexpr Score PassedFile[FILE_NB] = {
154- S ( 15 , 7 ), S (-5 , 14 ), S ( 1 , - 5 ), S (-22 ,- 11 ),
155- S (-22 ,- 11 ), S ( 1 , - 5 ), S (-5 , 14 ), S ( 15 , 7 )
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 )
156156 };
157157
158158 // PassedDanger[Rank] contains a term to weight the passed score
159159 constexpr int PassedDanger[RANK_NB] = { 0 , 0 , 0 , 3 , 6 , 12 , 21 };
160160
161161 // KingProtector[PieceType-2] contains a penalty according to distance from king
162- constexpr Score KingProtector[] = { S (3 , 5 ), S (4 , 3 ), S (3 , 0 ), S (1 , -1 ) };
162+ constexpr Score KingProtector[] = { S (3 , 5 ), S (5 , 3 ), S (3 , 0 ), S (0 , -2 ) };
163163
164164 // Assorted bonuses and penalties
165165 constexpr Score BishopPawns = S( 3 , 5 );
166- constexpr Score CloseEnemies = S( 7 , 0 );
166+ 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( 8 , 1 );
170+ constexpr Score HinderPassedPawn = S( 5 , 2 );
171171 constexpr Score KnightOnQueen = S( 21 , 11 );
172172 constexpr Score LongDiagonalBishop = S( 22 , 0 );
173173 constexpr Score MinorBehindPawn = S( 16 , 0 );
174174 constexpr Score Overload = S( 10 , 5 );
175175 constexpr Score PawnlessFlank = S( 20 , 80 );
176176 constexpr Score RookOnPawn = S( 8 , 24 );
177177 constexpr Score SliderOnQueen = S( 42 , 21 );
178- constexpr Score ThreatByPawnPush = S( 47 , 26 );
178+ constexpr Score ThreatByPawnPush = S( 49 , 30 );
179179 constexpr Score ThreatByRank = S( 16 , 3 );
180- constexpr Score ThreatBySafePawn = S(175 , 168 );
180+ constexpr Score ThreatBySafePawn = S(186 , 140 );
181181 constexpr Score TrappedRook = S( 92 , 0 );
182182 constexpr Score WeakQueen = S( 50 , 10 );
183- constexpr Score WeakUnopposedPawn = S( 5 , 25 );
183+ constexpr Score WeakUnopposedPawn = S( 14 , 19 );
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 = 0 ;
431+ int kingDanger = - mg_value (score) ;
432432 unsafeChecks = 0 ;
433433
434434 // Attacked squares defended at most once by our queen or king
@@ -474,12 +474,11 @@ namespace {
474474 unsafeChecks &= mobilityArea[Them];
475475
476476 kingDanger += kingAttackersCount[Them] * kingAttackersWeight[Them]
477- + 102 * kingAttacksCount[Them]
478- + 191 * popcount (kingRing[Us] & weak)
479- + 143 * popcount (pos.blockers_for_king (Us) | unsafeChecks)
480- - 848 * !pos.count <QUEEN>(Them)
481- - 9 * mg_value (score) / 8
482- + 40 ;
477+ + 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 ;
483482
484483 // Transform the kingDanger units into a Score, and subtract it from the evaluation
485484 if (kingDanger > 0 )
@@ -804,10 +803,9 @@ namespace {
804803 if ( pos.opposite_bishops ()
805804 && pos.non_pawn_material (WHITE) == BishopValueMg
806805 && pos.non_pawn_material (BLACK) == BishopValueMg)
807- // Endgame with opposite-colored bishops and no other pieces is almost a draw
808806 sf = 31 ;
809807 else
810- sf = std::min (40 + (pos.opposite_bishops ()? 2 : 7 ) * pos.count <PAWN>(strongSide), sf);
808+ sf = std::min (40 + (pos.opposite_bishops () ? 2 : 7 ) * pos.count <PAWN>(strongSide), sf);
811809 }
812810
813811 return ScaleFactor (sf);
0 commit comments