1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-07-11 19:49:14 +00:00

Do check analysis later in the game

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
This commit is contained in:
snicolet 2017-05-17 18:23:07 -07:00 committed by Joona Kiiski
parent cf893bcded
commit c216dcbe7b

View file

@ -240,7 +240,7 @@ namespace {
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)
@ -405,7 +405,7 @@ namespace {
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]
@ -426,7 +426,8 @@ namespace {
+ 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);