mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 08:43:09 +00:00
Add stealmate detection to evaluation
Currently a stealmate position is misevaluated in a negative/positive score, this leads qsearch(), that does not detects stealmates too, to return the wrong score and this yields to some kind of endgames to be completely misevaluated. With this patch is fully fixed follwing position 7k/6p1/6B1/5K1P/8/8/8/8 w - - 0 1 Also in SMP case. Correct root cause analysys by Ronald de Man. bench: 8678654
This commit is contained in:
parent
dc87ec7258
commit
9e8bf82350
1 changed files with 6 additions and 0 deletions
|
@ -787,6 +787,12 @@ namespace {
|
||||||
sf = ScaleFactor(50 * sf / SCALE_FACTOR_NORMAL);
|
sf = ScaleFactor(50 * sf / SCALE_FACTOR_NORMAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Stealmate detection
|
||||||
|
Color stm = pos.side_to_move();
|
||||||
|
if ( (ei.attackedBy[stm][ALL_PIECES] == ei.attackedBy[stm][KING])
|
||||||
|
&& (!(ei.attackedBy[stm][KING] & ~ei.attackedBy[~stm][ALL_PIECES])))
|
||||||
|
sf = SCALE_FACTOR_DRAW;
|
||||||
|
|
||||||
// Interpolate between a middlegame and a (scaled by 'sf') endgame score
|
// Interpolate between a middlegame and a (scaled by 'sf') endgame score
|
||||||
Value v = mg_value(score) * int(ei.mi->game_phase())
|
Value v = mg_value(score) * int(ei.mi->game_phase())
|
||||||
+ eg_value(score) * int(PHASE_MIDGAME - ei.mi->game_phase()) * sf / SCALE_FACTOR_NORMAL;
|
+ eg_value(score) * int(PHASE_MIDGAME - ei.mi->game_phase()) * sf / SCALE_FACTOR_NORMAL;
|
||||||
|
|
Loading…
Add table
Reference in a new issue