The previous patch has added a fraction of the king danger score to the
endgame score of the tapered eval, so it seems natural to perform the
king danger computation later in the endgame.
With this patch we extend the limit of such check analysis down to the
material of Rook+Knight, when we have at least two pieces attacking the
opponent king zone.
Passed STC:
LLR: 2.95 (-2.94,2.94) [0.00,5.00]
Total: 7446 W: 1409 L: 1253 D: 4784
http://tests.stockfishchess.org/tests/view/
591c097c0ebc59035df3477c
and LTC:
LLR: 2.96 (-2.94,2.94) [0.00,5.00]
Total: 14234 W: 1946 L: 1781 D: 10507
http://tests.stockfishchess.org/tests/view/
591c24f10ebc59035df3478c
Bench:
5975183
Closes #1121
ei.attackedBy[Us][ALL_PIECES] = b | ei.attackedBy[Us][PAWN];
// Init our king safety tables only if we are going to use them
ei.attackedBy[Us][ALL_PIECES] = b | ei.attackedBy[Us][PAWN];
// Init our king safety tables only if we are going to use them
- if (pos.non_pawn_material(Them) >= QueenValueMg)
+ if (pos.non_pawn_material(Them) >= RookValueMg + KnightValueMg)
{
ei.kingRing[Us] = b;
if (relative_rank(Us, pos.square<KING>(Us)) == RANK_1)
{
ei.kingRing[Us] = b;
if (relative_rank(Us, pos.square<KING>(Us)) == RANK_1)
Score score = ei.pe->king_safety<Us>(pos, ksq);
// Main king safety evaluation
Score score = ei.pe->king_safety<Us>(pos, ksq);
// Main king safety evaluation
- if (ei.kingAttackersCount[Them])
+ if (ei.kingAttackersCount[Them] > (1 - pos.count<QUEEN>(Them)))
{
// Find the attacked squares which are defended only by our king...
undefended = ei.attackedBy[Them][ALL_PIECES]
{
// Find the attacked squares which are defended only by our king...
undefended = ei.attackedBy[Them][ALL_PIECES]
+ 201 * popcount(undefended)
+ 143 * (popcount(b) + !!pos.pinned_pieces(Us))
- 848 * !pos.count<QUEEN>(Them)
+ 201 * popcount(undefended)
+ 143 * (popcount(b) + !!pos.pinned_pieces(Us))
- 848 * !pos.count<QUEEN>(Them)
- - 28 * mg_value(score) / 25 - 5;
+ - 9 * mg_value(score) / 8
+ + 40;
// Analyse the safe enemy's checks which are possible on next move
safe = ~pos.pieces(Them);
// Analyse the safe enemy's checks which are possible on next move
safe = ~pos.pieces(Them);