]> git.sesse.net Git - stockfish/commitdiff
Increase safe check bonus if multiple safe checks
authorLolligerhans <lolligerhans@gmx.de>
Thu, 16 Apr 2020 01:56:43 +0000 (03:56 +0200)
committerJoost VandeVondele <Joost.VandeVondele@gmail.com>
Thu, 16 Apr 2020 19:36:19 +0000 (21:36 +0200)
Add 50% "safe checks" bonus when there are multiple safe checks from the
same piece type.

LTC
LLR: 2.97 (-2.94,2.94) {0.25,1.75}
Total: 128184 W: 16491 L: 15954 D: 95739
Ptnml(0-2): 884, 11793, 38267, 12198, 950
https://tests.stockfishchess.org/tests/view/5e97d1b6c9ada107a0370e03

STC
LLR: 2.94 (-2.94,2.94) {-0.50,1.50}
Total: 19022 W: 3733 L: 3514 D: 11775
Ptnml(0-2): 338, 2103, 4414, 2314, 342
https://tests.stockfishchess.org/tests/view/5e97c377c9ada107a0370ddf

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

Bench: 5057329

src/evaluate.cpp

index 7eafacf8233a4a74eb11c748e232cada3854ee18..0b1956f10824cd6cb66c8cf6d2c20067312723b5 100644 (file)
@@ -398,9 +398,9 @@ namespace {
 
     // Enemy rooks checks
     rookChecks = b1 & safe & attackedBy[Them][ROOK];
-
     if (rookChecks)
-        kingDanger += RookSafeCheck;
+        kingDanger += more_than_one(rookChecks) ? RookSafeCheck * 3/2
+                                                : RookSafeCheck;
     else
         unsafeChecks |= b1 & attackedBy[Them][ROOK];
 
@@ -411,9 +411,9 @@ namespace {
                  & safe
                  & ~attackedBy[Us][QUEEN]
                  & ~rookChecks;
-
     if (queenChecks)
-        kingDanger += QueenSafeCheck;
+        kingDanger += more_than_one(queenChecks) ? QueenSafeCheck * 3/2
+                                                 : QueenSafeCheck;
 
     // Enemy bishops checks: we count them only if they are from squares from
     // which we can't give a queen check, because queen checks are more valuable.
@@ -421,17 +421,17 @@ namespace {
                   & attackedBy[Them][BISHOP]
                   & safe
                   & ~queenChecks;
-
     if (bishopChecks)
-        kingDanger += BishopSafeCheck;
+        kingDanger += more_than_one(bishopChecks) ? BishopSafeCheck * 3/2
+                                                  : BishopSafeCheck;
     else
         unsafeChecks |= b2 & attackedBy[Them][BISHOP];
 
     // Enemy knights checks
     knightChecks = pos.attacks_from<KNIGHT>(ksq) & attackedBy[Them][KNIGHT];
-
     if (knightChecks & safe)
-        kingDanger += KnightSafeCheck;
+        kingDanger += more_than_one(knightChecks & safe) ? KnightSafeCheck * 3/2
+                                                         : KnightSafeCheck;
     else
         unsafeChecks |= knightChecks;