1
0
Fork 0

Attack threats

Give bonus for safe attack threats from bishops and rooks on opponent queen

STC:
LLR: 2.97 (-2.94,2.94) [0.00,5.00]
Total: 8629 W: 1599 L: 1438 D: 5592
http://tests.stockfishchess.org/tests/view/5a1ad4490ebc590ccbb8b30d

LTC:
LLR: 2.96 (-2.94,2.94) [0.00,5.00]
Total: 7093 W: 987 L: 846 D: 5260
http://tests.stockfishchess.org/tests/view/5a1aec5d0ebc590ccbb8b317

Bench: 5051254
pull/1285/head^2
Stefan Geschwentner 2017-12-03 10:41:48 +01:00 committed by Marco Costalba
parent 7dd1f4a7c0
commit a87a1005ad
2 changed files with 32 additions and 17 deletions

View File

@ -211,23 +211,24 @@ namespace {
const Score KingProtector[] = { S(-3, -5), S(-4, -3), S(-3, 0), S(-1, 1) };
// Assorted bonuses and penalties used by evaluation
const Score MinorBehindPawn = S( 16, 0);
const Score BishopPawns = S( 8, 12);
const Score LongRangedBishop = S( 22, 0);
const Score RookOnPawn = S( 8, 24);
const Score TrappedRook = S( 92, 0);
const Score WeakQueen = S( 50, 10);
const Score OtherCheck = S( 10, 10);
const Score CloseEnemies = S( 7, 0);
const Score PawnlessFlank = S( 20, 80);
const Score ThreatByHangingPawn = S( 71, 61);
const Score ThreatBySafePawn = S(192,175);
const Score ThreatByRank = S( 16, 3);
const Score Hanging = S( 48, 27);
const Score WeakUnopposedPawn = S( 5, 25);
const Score ThreatByPawnPush = S( 38, 22);
const Score HinderPassedPawn = S( 7, 0);
const Score TrappedBishopA1H1 = S( 50, 50);
const Score MinorBehindPawn = S( 16, 0);
const Score BishopPawns = S( 8, 12);
const Score LongRangedBishop = S( 22, 0);
const Score RookOnPawn = S( 8, 24);
const Score TrappedRook = S( 92, 0);
const Score WeakQueen = S( 50, 10);
const Score OtherCheck = S( 10, 10);
const Score CloseEnemies = S( 7, 0);
const Score PawnlessFlank = S( 20, 80);
const Score ThreatByHangingPawn = S( 71, 61);
const Score ThreatBySafePawn = S(192,175);
const Score ThreatByRank = S( 16, 3);
const Score Hanging = S( 48, 27);
const Score WeakUnopposedPawn = S( 5, 25);
const Score ThreatByPawnPush = S( 38, 22);
const Score ThreatByAttackOnQueen = S( 38, 22);
const Score HinderPassedPawn = S( 7, 0);
const Score TrappedBishopA1H1 = S( 50, 50);
#undef S
#undef V
@ -303,6 +304,9 @@ namespace {
attackedBy[Us][Pt] = 0;
if (Pt == QUEEN)
attackedBy[Us][QUEEN_DIAGONAL] = 0;
while ((s = *pl++) != SQ_NONE)
{
// Find attacked squares, including x-ray attacks for bishops and rooks
@ -316,6 +320,9 @@ namespace {
attackedBy2[Us] |= attackedBy[Us][ALL_PIECES] & b;
attackedBy[Us][ALL_PIECES] |= attackedBy[Us][Pt] |= b;
if (Pt == QUEEN)
attackedBy[Us][QUEEN_DIAGONAL] |= b & PseudoAttacks[BISHOP][s];
if (b & kingRing[Them])
{
kingAttackersCount[Us]++;
@ -609,6 +616,13 @@ namespace {
score += ThreatByPawnPush * popcount(b);
// Add a bonus for safe slider attack threats on opponent queen
safeThreats = ~pos.pieces(Us) & ~attackedBy2[Them] & attackedBy2[Us];
b = (attackedBy[Us][BISHOP] & attackedBy[Them][QUEEN_DIAGONAL])
| (attackedBy[Us][ROOK ] & attackedBy[Them][QUEEN] & ~attackedBy[Them][QUEEN_DIAGONAL]);
score += ThreatByAttackOnQueen * popcount(b & safeThreats);
if (T)
Trace::add(THREAT, Us, score);

View File

@ -195,6 +195,7 @@ enum Value : int {
enum PieceType {
NO_PIECE_TYPE, PAWN, KNIGHT, BISHOP, ROOK, QUEEN, KING,
ALL_PIECES = 0,
QUEEN_DIAGONAL = 7,
PIECE_TYPE_NB = 8
};