1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-30 08:43:09 +00:00

Rank based threats

STC:
LLR: 2.95 (-2.94,2.94) [0.00,5.00]
Total: 19404 W: 3581 L: 3374 D: 12449

LTC:
LLR: 2.96 (-2.94,2.94) [0.00,5.00]
Total: 16204 W: 2194 L: 2023 D: 11987

Bench: 5757843
This commit is contained in:
mbootsector 2016-11-25 17:47:18 +01:00 committed by Marco Costalba
parent 8ceb1ff53b
commit e7289465b9

View file

@ -200,6 +200,7 @@ namespace {
const Score Unstoppable = S( 0, 20);
const Score PawnlessFlank = S(20, 80);
const Score HinderPassedPawn = S( 7, 0);
const Score ThreatByRank = S(16, 3);
// Penalty for a bishop on a1/h1 (a8/h8 for black) which is trapped by
// a friendly pawn on b2/g2 (b7/g7 for black). This can obviously only
@ -561,11 +562,21 @@ namespace {
{
b = (defended | weak) & (ei.attackedBy[Us][KNIGHT] | ei.attackedBy[Us][BISHOP]);
while (b)
score += Threat[Minor][type_of(pos.piece_on(pop_lsb(&b)))];
{
Square s = pop_lsb(&b);
score += Threat[Minor][type_of(pos.piece_on(s))];
if (type_of(pos.piece_on(s)) != PAWN)
score += ThreatByRank * (int)relative_rank(Them, s);
}
b = (pos.pieces(Them, QUEEN) | weak) & ei.attackedBy[Us][ROOK];
while (b)
score += Threat[Rook ][type_of(pos.piece_on(pop_lsb(&b)))];
{
Square s = pop_lsb(&b);
score += Threat[Rook][type_of(pos.piece_on(s))];
if (type_of(pos.piece_on(s)) != PAWN)
score += ThreatByRank * (int)relative_rank(Them, s);
}
score += Hanging * popcount(weak & ~ei.attackedBy[Them][ALL_PIECES]);