Skip to content

Commit

Permalink
Increase safe check bonus if multiple safe checks
Browse files Browse the repository at this point in the history
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 #2636

Bench: 5057329
  • Loading branch information
Lolligerhans authored and vondele committed Apr 16, 2020
1 parent d87adcc commit 6f35af7
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/evaluate.cpp
Expand Up @@ -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];

Expand All @@ -411,27 +411,27 @@ 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.
bishopChecks = b2
& 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;

Expand Down

0 comments on commit 6f35af7

Please sign in to comment.