summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
f39cf1b)
The case of two lone kings on the board is already considered
by the "No pawns" scaling factor rules in material.cpp as is
KBK and KNK.
Moreover we had a small leak in endgames map because for
KK endgame it happens white and black material keys are the
same (both equal to zero), so when adding the black endgame in
Endgames::add() we were overwriting the already exsisting
white one, leading to a memory leak found by Valgrind.
So remove the endgames althogheter and rely on scaling
to correctly set the endgames value to a draw.
No functional change.
- add<KBK>("KBK");
- add<KNK>("KNK");
add<KNNK>("KNNK");
add<KBNK>("KBNK");
add<KRKP>("KRKP");
add<KNNK>("KNNK");
add<KBNK>("KBNK");
add<KRKP>("KRKP");
/// Some cases of trivial draws
/// Some cases of trivial draws
-template<> Value Endgame<KK>::operator()(const Position&) const { return VALUE_DRAW; }
-template<> Value Endgame<KBK>::operator()(const Position&) const { return VALUE_DRAW; }
-template<> Value Endgame<KNK>::operator()(const Position&) const { return VALUE_DRAW; }
template<> Value Endgame<KNNK>::operator()(const Position&) const { return VALUE_DRAW; }
template<> Value Endgame<KmmKm>::operator()(const Position&) const { return VALUE_DRAW; }
template<> Value Endgame<KNNK>::operator()(const Position&) const { return VALUE_DRAW; }
template<> Value Endgame<KmmKm>::operator()(const Position&) const { return VALUE_DRAW; }
- KK, // K vs K
- KBK, // KB vs K
- KNK, // KN vs K
KNNK, // KNN vs K
KXK, // Generic "mate lone king" eval
KBNK, // KBN vs K
KNNK, // KNN vs K
KXK, // Generic "mate lone king" eval
KBNK, // KBN vs K
- // No pawns makes it difficult to win, even with a material advantage
+ // No pawns makes it difficult to win, even with a material advantage. This
+ // catches some trivial draws like KK, KBK and KNK
if (!pos.count<PAWN>(WHITE) && npm_w - npm_b <= BishopValueMg)
{
e->factor[WHITE] = (uint8_t)
if (!pos.count<PAWN>(WHITE) && npm_w - npm_b <= BishopValueMg)
{
e->factor[WHITE] = (uint8_t)