1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-07-11 19:49:14 +00:00

Increase safe check bonus if multiple safe checks

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
This commit is contained in:
Lolligerhans 2020-04-16 03:56:43 +02:00 committed by Joost VandeVondele
parent d87adcc006
commit 6f35af7ad3

View file

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