Skip to content

Commit 9dc57b6

Browse files
Rocky640snicolet
authored andcommitted
Passed file cleanup
Protonspring had a successful functional simplification that removes the PassedFile array using a simple linear equation. Merge the additive term S(5, 10) of protonspring passed file simplification (pull request #2250) into the PassedRank array. This harmless change has a different bench because the candidate passer evaluation will always get less compared to #2250, as we apply bonus = bonus /2. Tested as a non-regression against #2250 Passed STC http://tests.stockfishchess.org/tests/view/5d33427e0ebc5925cf0e6fa2 LLR: 2.96 (-2.94,2.94) [-3.00,1.00] Total: 81459 W: 18174 L: 18171 D: 45114 Passed LTC http://tests.stockfishchess.org/tests/view/5d335c8d0ebc5925cf0e731e LLR: 2.95 (-2.94,2.94) [-3.00,1.00] Total: 18525 W: 3176 L: 3052 D: 12297 Closes #2250 Closes #2251 Bench: 3859856
1 parent fd96cba commit 9dc57b6

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/evaluate.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -123,13 +123,7 @@ namespace {
123123

124124
// PassedRank[Rank] contains a bonus according to the rank of a passed pawn
125125
constexpr Score PassedRank[RANK_NB] = {
126-
S(0, 0), S(5, 18), S(12, 23), S(10, 31), S(57, 62), S(163, 167), S(271, 250)
127-
};
128-
129-
// PassedFile[File] contains a bonus according to the file of a passed pawn
130-
constexpr Score PassedFile[FILE_NB] = {
131-
S( -1, 7), S( 0, 9), S(-9, -8), S(-30,-14),
132-
S(-30,-14), S(-9, -8), S( 0, 9), S( -1, 7)
126+
S(0, 0), S(10, 28), S(17, 33), S(15, 41), S(62, 72), S(168, 177), S(276, 260)
133127
};
134128

135129
// Assorted bonuses and penalties
@@ -142,6 +136,7 @@ namespace {
142136
constexpr Score LongDiagonalBishop = S( 45, 0);
143137
constexpr Score MinorBehindPawn = S( 18, 3);
144138
constexpr Score Outpost = S( 18, 6);
139+
constexpr Score PassedFile = S( 11, 8);
145140
constexpr Score PawnlessFlank = S( 17, 95);
146141
constexpr Score RestrictedPiece = S( 7, 7);
147142
constexpr Score RookOnPawn = S( 10, 32);
@@ -616,6 +611,7 @@ namespace {
616611
assert(!(pos.pieces(Them, PAWN) & forward_file_bb(Us, s + Up)));
617612

618613
int r = relative_rank(Us, s);
614+
File f = file_of(s);
619615

620616
Score bonus = PassedRank[r];
621617

@@ -665,7 +661,7 @@ namespace {
665661
|| (pos.pieces(PAWN) & (s + Up)))
666662
bonus = bonus / 2;
667663

668-
score += bonus + PassedFile[file_of(s)];
664+
score += bonus - PassedFile * std::min(f, ~f);
669665
}
670666

671667
if (T)

0 commit comments

Comments
 (0)