mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 00:33:09 +00:00
Fix an assert in KBK endgame
The endgame king + minor vs king is erroneusly detected as king + minor vs king + minor Here the fix is to detect king + minor earlier, in particular to add these trivial cases to endgame evaluation functions. Spotted by Reuven Peleg bench: 4727133
This commit is contained in:
parent
7487eb0dca
commit
6373e88b5b
2 changed files with 13 additions and 11 deletions
|
@ -89,7 +89,10 @@ namespace {
|
|||
|
||||
Endgames::Endgames() {
|
||||
|
||||
add<KK>("KK");
|
||||
add<KPK>("KPK");
|
||||
add<KBK>("KBK");
|
||||
add<KNK>("KNK");
|
||||
add<KNNK>("KNNK");
|
||||
add<KBNK>("KBNK");
|
||||
add<KRKP>("KRKP");
|
||||
|
@ -410,17 +413,13 @@ Value Endgame<KBBKN>::operator()(const Position& pos) const {
|
|||
}
|
||||
|
||||
|
||||
/// K and two minors vs K and one or two minors or K and two knights against
|
||||
/// king alone are always draw.
|
||||
template<>
|
||||
Value Endgame<KmmKm>::operator()(const Position&) const {
|
||||
return VALUE_DRAW;
|
||||
}
|
||||
/// 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;
|
||||
}
|
||||
|
||||
/// K, bishop and one or more pawns vs K. It checks for draws with rook pawns and
|
||||
/// a bishop of the wrong color. If such a draw is detected, SCALE_FACTOR_DRAW
|
||||
|
|
|
@ -33,6 +33,10 @@ enum EndgameType {
|
|||
|
||||
// Evaluation functions
|
||||
|
||||
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
|
||||
KPK, // KP vs K
|
||||
|
@ -42,7 +46,6 @@ enum EndgameType {
|
|||
KQKP, // KQ vs KP
|
||||
KQKR, // KQ vs KR
|
||||
KBBKN, // KBB vs KN
|
||||
KNNK, // KNN vs K
|
||||
KmmKm, // K and two minors vs K and one or two minors
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue