]> git.sesse.net Git - stockfish/commitdiff
Tweak the formulas for unsafeSquares
authorFauziAkram <fauzi.dabat@hotmail.com>
Sun, 20 Dec 2020 15:50:34 +0000 (17:50 +0200)
committerJoost VandeVondele <Joost.VandeVondele@gmail.com>
Wed, 23 Dec 2020 19:17:57 +0000 (20:17 +0100)
We give more bonus for a special case: If there are some enemy squares occupied
or attacked by the enemy on the passed pawn span,
but if they are all attacked by our pawn, use new intermediate factor 30.

The main credit goes to Rocky for the idea, with additional tuning and tests.

Passed STC:
LLR: 2.95 (-2.94,2.94) {-0.25,1.25}
Total: 96464 W: 19233 L: 18834 D: 58397
Ptnml(0-2): 1683, 11327, 21950, 11452, 1820
https://tests.stockfishchess.org/tests/view/5fdd21ab3932f79192d39357

Passed LTC:
LLR: 2.94 (-2.94,2.94) {0.25,1.25}
Total: 81320 W: 10784 L: 10352 D: 60184
Ptnml(0-2): 602, 7524, 24044, 7820, 670
https://tests.stockfishchess.org/tests/view/5fddec983932f79192d393a4

closes https://github.com/official-stockfish/Stockfish/pull/3268

Bench: 4338972

src/evaluate.cpp

index dd5d23b253dd074a0feef432367a899d9dc1e1b3..c945cf53345d05cda38c342734bf7a1156de4c7c 100644 (file)
@@ -791,11 +791,13 @@ namespace {
                     unsafeSquares &= attackedBy[Them][ALL_PIECES] | pos.pieces(Them);
 
                 // If there are no enemy pieces or attacks on passed pawn span, assign a big bonus.
                     unsafeSquares &= attackedBy[Them][ALL_PIECES] | pos.pieces(Them);
 
                 // If there are no enemy pieces or attacks on passed pawn span, assign a big bonus.
+                // Or if there is some, but they are all attacked by our pawns, assign a bit smaller bonus.
                 // Otherwise assign a smaller bonus if the path to queen is not attacked
                 // and even smaller bonus if it is attacked but block square is not.
                 // Otherwise assign a smaller bonus if the path to queen is not attacked
                 // and even smaller bonus if it is attacked but block square is not.
-                int k = !unsafeSquares                    ? 35 :
-                        !(unsafeSquares & squaresToQueen) ? 20 :
-                        !(unsafeSquares & blockSq)        ?  9 :
+                int k = !unsafeSquares                    ? 36 :
+                !(unsafeSquares & ~attackedBy[Us][PAWN])  ? 30 :
+                        !(unsafeSquares & squaresToQueen) ? 17 :
+                        !(unsafeSquares & blockSq)        ?  7 :
                                                              0 ;
 
                 // Assign a larger bonus if the block square is defended
                                                              0 ;
 
                 // Assign a larger bonus if the block square is defended