Skip to content

Commit

Permalink
Small Queen simplification
Browse files Browse the repository at this point in the history
Moving a few lines from evaluate_threats to evaluate_pieces allows to
a) Remove a condition pos.count<QUEEN>(Them) == 1
b) use precalculated s instead of pos.square(Them)
c) do not check the condition at all in queenless endings

Passed STC
http://tests.stockfishchess.org/tests/view/5752e0410ebc59029919b1f4
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 67175 W: 12194 L: 12152 D: 42829

and LTC
http://tests.stockfishchess.org/tests/view/57587b140ebc59029919b2f4
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 20276 W: 2774 L: 2653 D: 14849

bench: 7907962
  • Loading branch information
Rocky640 authored and mcostalba committed Jun 10, 2016
1 parent 0c076f1 commit 6fed8ff
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/evaluate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,13 @@ namespace {
score -= (TrappedRook - make_score(mob * 22, 0)) * (1 + !pos.can_castle(Us));
}
}

if (Pt == QUEEN)
{
// Penalty if any relative pin or discovered attack against the queen
if (pos.slider_blockers(pos.pieces(), pos.pieces(Them, ROOK, BISHOP), s))
score -= WeakQueen;
}
}

if (DoTrace)
Expand Down Expand Up @@ -489,13 +496,6 @@ namespace {
& ~(ei.attackedBy[Us][ALL_PIECES] | ei.attackedBy[Them][ALL_PIECES]))
score += LooseEnemies;

// Bonus for pin or discovered attack on the opponent queen
if ( pos.count<QUEEN>(Them) == 1
&& pos.slider_blockers(pos.pieces(),
pos.pieces(Us, ROOK, BISHOP),
pos.square<QUEEN>(Them)))
score += WeakQueen;

// Non-pawn enemies attacked by a pawn
weak = (pos.pieces(Them) ^ pos.pieces(Them, PAWN)) & ei.attackedBy[Us][PAWN];

Expand Down

0 comments on commit 6fed8ff

Please sign in to comment.