From: Alain SAVARD Date: Sat, 20 Jul 2019 15:38:45 +0000 (-0400) Subject: Passed file cleanup X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=9dc57b660eb22190166c006eb99319c2b321e4f7 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 https://github.com/official-stockfish/Stockfish/pull/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 https://github.com/official-stockfish/Stockfish/pull/2250 Closes https://github.com/official-stockfish/Stockfish/pull/2251 Bench: 3859856 --- diff --git a/src/evaluate.cpp b/src/evaluate.cpp index 23af60f3..7359eb92 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -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 @@ -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); @@ -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]; @@ -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)