mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 00:33:09 +00:00
Give a reduced bonus for threats by hanging pawns
Passed STC: LLR: 2.96 (-2.94,2.94) [-1.50,4.50] Total: 105539 W: 20389 L: 20001 D: 65149 and LTC: LLR: 2.95 (-2.94,2.94) [0.00,6.00] Total: 9629 W: 1577 L: 1432 D: 6620 Bench: 7658627 Resolves #317
This commit is contained in:
parent
1d5eaba573
commit
63500274db
1 changed files with 20 additions and 6 deletions
|
@ -158,6 +158,8 @@ namespace {
|
|||
S(0, 0), S(0, 0), S(107, 138), S(84, 122), S(114, 203), S(121, 217)
|
||||
};
|
||||
|
||||
const Score ThreatenedByHangingPawn = S(40, 60);
|
||||
|
||||
// Assorted bonuses and penalties used by evaluation
|
||||
const Score KingOnOne = S( 2, 58);
|
||||
const Score KingOnMany = S( 6,125);
|
||||
|
@ -305,11 +307,6 @@ namespace {
|
|||
|
||||
mobility[Us] += MobilityBonus[Pt][mob];
|
||||
|
||||
// Decrease score if we are attacked by an enemy pawn. The remaining part
|
||||
// of threat evaluation must be done later when we have full attack info.
|
||||
if (ei.attackedBy[Them][PAWN] & s)
|
||||
score -= ThreatenedByPawn[Pt];
|
||||
|
||||
if (Pt == BISHOP || Pt == KNIGHT)
|
||||
{
|
||||
// Bonus for outpost square
|
||||
|
@ -501,9 +498,26 @@ namespace {
|
|||
enum { Defended, Weak };
|
||||
enum { Minor, Major };
|
||||
|
||||
Bitboard b, weak, defended;
|
||||
Bitboard b, weak, defended, safe_pawns, safe_pawn_threats, unsafe_pawn_threats;
|
||||
Score score = SCORE_ZERO;
|
||||
|
||||
// Pawn Threats
|
||||
b = ei.attackedBy[Us][PAWN] & (pos.pieces(Them) ^ pos.pieces(Them, PAWN));
|
||||
if(b)
|
||||
{
|
||||
safe_pawns = pos.pieces(Us, PAWN) & (~ei.attackedBy[Them][ALL_PIECES] | ei.attackedBy[Us][ALL_PIECES]);
|
||||
safe_pawn_threats = (shift_bb<Right>(safe_pawns) | shift_bb<Left>(safe_pawns)) & (pos.pieces(Them) ^ pos.pieces(Them, PAWN));
|
||||
unsafe_pawn_threats = b ^ safe_pawn_threats;
|
||||
// Unsafe pawn threats
|
||||
if(unsafe_pawn_threats)
|
||||
score += ThreatenedByHangingPawn;
|
||||
|
||||
// Evaluate safe pawn threats
|
||||
while(safe_pawn_threats)
|
||||
score += ThreatenedByPawn[type_of(pos.piece_on(pop_lsb(&safe_pawn_threats)))];
|
||||
|
||||
}
|
||||
|
||||
// Non-pawn enemies defended by a pawn
|
||||
defended = (pos.pieces(Them) ^ pos.pieces(Them, PAWN)) & ei.attackedBy[Them][PAWN];
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue