Skip to content

Commit 062eb07

Browse files
candirufishsnicolet
authored andcommitted
Tuned values after 505k games
Various king and pawn tuned eval values after 505k 60 sec 600 nodes time SPSA games. Adjusted passed rank and file values to be symmetrical. Passed LTC (after passed rank/file adjustment): LLR: 2.95 (-2.94,2.94) [0.00,4.00] Total: 37906 W: 6953 L: 6668 D: 24285 http://tests.stockfishchess.org/tests/view/5b2790960ebc5902b8d17ba1 A previous, very similar version with raw tuned values passed STC and LTC: STC: LLR: 2.95 (-2.94,2.94) [0.00,4.00] Total: 39515 W: 9227 L: 8900 D: 21388 http://tests.stockfishchess.org/tests/view/5b277e3e0ebc5902b8d17ac9 LTC: LLR: 2.95 (-2.94,2.94) [0.00,4.00] Total: 14618 W: 2743 L: 2537 D: 9338 http://tests.stockfishchess.org/tests/view/5b2785020ebc5902b8d17b98 Closes #1654 bench: 4777396
1 parent 06a853e commit 062eb07

File tree

2 files changed

+29
-31
lines changed

2 files changed

+29
-31
lines changed

src/evaluate.cpp

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -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);

src/pawns.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,35 +32,35 @@ namespace {
3232
#define S(mg, eg) make_score(mg, eg)
3333

3434
// Pawn penalties
35-
constexpr Score Isolated = S(13, 16);
36-
constexpr Score Backward = S(17, 11);
37-
constexpr Score Doubled = S(13, 40);
35+
constexpr Score Isolated = S( 6, 16);
36+
constexpr Score Backward = S(15, 21);
37+
constexpr Score Doubled = S( 8, 44);
3838

3939
// Connected pawn bonus by opposed, phalanx, #support and rank
4040
Score Connected[2][2][3][RANK_NB];
4141

4242
// Strength of pawn shelter for our king by [distance from edge][rank].
4343
// RANK_1 = 0 is used for files where we have no pawn, or pawn is behind our king.
4444
constexpr Value ShelterStrength[int(FILE_NB) / 2][RANK_NB] = {
45-
{ V( 7), V(76), V( 84), V( 38), V( 7), V( 30), V(-19) },
46-
{ V(-13), V(83), V( 42), V(-27), V( 2), V(-32), V(-45) },
47-
{ V(-26), V(63), V( 5), V(-44), V( -5), V( 2), V(-59) },
48-
{ V(-19), V(53), V(-11), V(-22), V(-12), V(-51), V(-60) }
45+
{ V( 28), V(79), V( 75), V( 46), V( 14), V( 31), V(-14) },
46+
{ V(-48), V(50), V( 29), V(-21), V(-41), V(-23), V(-45) },
47+
{ V(-25), V(50), V( 17), V(-33), V( -5), V( 9), V(-35) },
48+
{ V(-29), V(57), V(-25), V(-48), V( -4), V(-46), V(-64) }
4949
};
5050

5151
// Danger of enemy pawns moving toward our king by [distance from edge][rank].
5252
// RANK_1 = 0 is used for files where the enemy has no pawn, or their pawn
5353
// is behind our king.
5454
constexpr Value UnblockedStorm[int(FILE_NB) / 2][RANK_NB] = {
55-
{ V( 25), V( 79), V(107), V( 51), V( 27), V( 0), V( 0) },
56-
{ V( 5), V( 35), V(121), V( -2), V( 15), V(-10), V(-10) },
57-
{ V(-20), V( 22), V( 98), V( 36), V( 7), V(-20), V(-20) },
58-
{ V(-27), V( 24), V( 80), V( 25), V( -4), V(-30), V(-30) }
55+
{ V( 34), V( 58), V(113), V( 61), V(37), V( 24), V( 21) },
56+
{ V( 23), V( 46), V( 93), V( 10), V( 2), V(-20), V( 6) },
57+
{ V( -6), V( 22), V(106), V( 28), V( 6), V(-33), V( -1) },
58+
{ V(-17), V( 33), V( 71), V( 14), V(-9), V(-21), V(-16) }
5959
};
6060

6161
// Danger of blocked enemy pawns storming our king, by rank
6262
constexpr Value BlockedStorm[RANK_NB] =
63-
{ V( 0), V( 0), V( 75), V(-10), V(-20), V(-20), V(-20) };
63+
{ V(0), V(0), V( 58), V(-13), V(-22), V(-3), V(-5) };
6464

6565
#undef S
6666
#undef V

0 commit comments

Comments
 (0)