]> git.sesse.net Git - stockfish/commitdiff
Linear formula for w. Bench: 3328507 (#2239)
author31m059 <37052095+31m059@users.noreply.github.com>
Sun, 14 Jul 2019 12:40:45 +0000 (08:40 -0400)
committerMarco Costalba <mcostalba@users.noreply.github.com>
Sun, 14 Jul 2019 12:40:45 +0000 (14:40 +0200)
In Stockfish, both the middlegame and endgame bonus for a passed pawn are calculated as a product of two factors. The first is k, chosen based on the presence of defended and unsafe squares. The second is w, a quadratic function of the pawn's rank. Both are only applied if the pawn's relative rank is at least RANK_4.

It does not appear that the complexity of a quadratic function is necessary for w. Here, we replace it with a simpler linear one, which performs equally at both STC and LTC.

STC:
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 46814 W: 10386 L: 10314 D: 26114
http://tests.stockfishchess.org/tests/view/5d29686e0ebc5925cf0d76a1

LTC:
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 82372 W: 13845 L: 13823 D: 54704
http://tests.stockfishchess.org/tests/view/5d2980650ebc5925cf0d7bfd

Bench: 3328507

src/evaluate.cpp

index a52cdf0928ab5cdc72800eb4439464979cd57110..b20c93b706296c94b1a0c8652c4e4c87cb6a95e3 100644 (file)
@@ -622,7 +622,7 @@ namespace {
 
         if (r > RANK_3)
         {
-            int w = (r-2) * (r-2) + 2;
+            int w = 5 * r - 13;
             Square blockSq = s + Up;
 
             // Adjust bonus based on the king's proximity