Skip to content

Commit

Permalink
Passed file cleanup
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Rocky640 authored and snicolet committed Jul 25, 2019
1 parent fd96cba commit 9dc57b6
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/evaluate.cpp
Expand Up @@ -123,13 +123,7 @@ namespace {

// PassedRank[Rank] contains a bonus according to the rank of a passed pawn
constexpr Score PassedRank[RANK_NB] = {
S(0, 0), S(5, 18), S(12, 23), S(10, 31), S(57, 62), S(163, 167), S(271, 250)
};

// PassedFile[File] contains a bonus according to the file of a passed pawn
constexpr Score PassedFile[FILE_NB] = {
S( -1, 7), S( 0, 9), S(-9, -8), S(-30,-14),
S(-30,-14), S(-9, -8), S( 0, 9), S( -1, 7)
S(0, 0), S(10, 28), S(17, 33), S(15, 41), S(62, 72), S(168, 177), S(276, 260)
};

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

int r = relative_rank(Us, s);
File f = file_of(s);

Score bonus = PassedRank[r];

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

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

if (T)
Expand Down

0 comments on commit 9dc57b6

Please sign in to comment.