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;