mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-23 10:36:26 +08:00
Add min pawn-king distance to endgame evaluation
At endgame time push the king near his pawns (actually one of them). Original idea is from Critter (although slightly different), implementation is mine and is completely different from the original, in particular it is different the algorithm to compute the minimum distance from pawns. After 19895 games at 15"+0.05 Mod vs Orig 3638 - 3248 - 13009 ELO +7 Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
@@ -268,7 +268,7 @@ Score PawnEntry::update_safety(const Position& pos, Square ksq) {
|
|||||||
while (!(DistanceRingsBB[ksq][minKPdistance[Us]++] & pawns)) {}
|
while (!(DistanceRingsBB[ksq][minKPdistance[Us]++] & pawns)) {}
|
||||||
|
|
||||||
if (relative_rank(Us, ksq) > RANK_4)
|
if (relative_rank(Us, ksq) > RANK_4)
|
||||||
return kingSafety[Us] = SCORE_ZERO;
|
return kingSafety[Us] = make_score(0, -16 * minKPdistance[Us]);
|
||||||
|
|
||||||
Value bonus = shelter_storm<Us>(pos, ksq);
|
Value bonus = shelter_storm<Us>(pos, ksq);
|
||||||
|
|
||||||
@@ -279,7 +279,7 @@ Score PawnEntry::update_safety(const Position& pos, Square ksq) {
|
|||||||
if (pos.can_castle(make_castle_right(Us, QUEEN_SIDE)))
|
if (pos.can_castle(make_castle_right(Us, QUEEN_SIDE)))
|
||||||
bonus = std::max(bonus, shelter_storm<Us>(pos, relative_square(Us, SQ_C1)));
|
bonus = std::max(bonus, shelter_storm<Us>(pos, relative_square(Us, SQ_C1)));
|
||||||
|
|
||||||
return kingSafety[Us] = make_score(bonus, 0);
|
return kingSafety[Us] = make_score(bonus, -16 * minKPdistance[Us]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Explicit template instantiation
|
// Explicit template instantiation
|
||||||
|
|||||||
Reference in New Issue
Block a user