Skip to content

Commit 9f5b31c

Browse files
jcalovskizamar
authored andcommitted
Bonus for checking moves
STC: LLR: 2.97 (-2.94,2.94) [0.00,5.00] Total: 14531 W: 2765 L: 2576 D: 9190 LTC: LLR: 3.20 (-2.94,2.94) [0.00,5.00] Total: 52518 W: 8107 L: 7782 D: 36629 Bench: 7556477 Resolves #435
1 parent 3c0fe1d commit 9f5b31c

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/evaluate.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ namespace {
184184
const Score Unstoppable = S( 0, 20);
185185
const Score Hanging = S(31, 26);
186186
const Score PawnAttackThreat = S(20, 20);
187+
const Score Checked = S(20, 20);
187188

188189
// Penalty for a bishop on a1/h1 (a8/h8 for black) which is trapped by
189190
// a friendly pawn on b2/g2 (b7/g7 for black). This can obviously only
@@ -440,22 +441,34 @@ namespace {
440441
// Enemy queen safe checks
441442
b = (b1 | b2) & ei.attackedBy[Them][QUEEN];
442443
if (b)
444+
{
443445
attackUnits += QueenCheck * popcount<Max15>(b);
446+
score -= Checked;
447+
}
444448

445449
// Enemy rooks safe checks
446450
b = b1 & ei.attackedBy[Them][ROOK];
447451
if (b)
452+
{
448453
attackUnits += RookCheck * popcount<Max15>(b);
454+
score -= Checked;
455+
}
449456

450457
// Enemy bishops safe checks
451458
b = b2 & ei.attackedBy[Them][BISHOP];
452459
if (b)
460+
{
453461
attackUnits += BishopCheck * popcount<Max15>(b);
462+
score -= Checked;
463+
}
454464

455465
// Enemy knights safe checks
456466
b = pos.attacks_from<KNIGHT>(ksq) & ei.attackedBy[Them][KNIGHT] & safe;
457467
if (b)
468+
{
458469
attackUnits += KnightCheck * popcount<Max15>(b);
470+
score -= Checked;
471+
}
459472

460473
// Finally, extract the king danger score from the KingDanger[]
461474
// array and subtract the score from evaluation.

0 commit comments

Comments
 (0)