mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 00:33:09 +00:00
There is no need to special case KNNK ending
It is always draw, so use the corresponding proper evaluation function. No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
parent
23ceb66950
commit
aa925a0e29
3 changed files with 9 additions and 13 deletions
|
@ -348,11 +348,18 @@ Value EvaluationFunction<KBBKN>::apply(const Position& pos) {
|
|||
return (strongerSide == pos.side_to_move() ? result : -result);
|
||||
}
|
||||
|
||||
|
||||
/// K and two minors vs K and one or two minors or K and two knights against
|
||||
/// king alone are always draw.
|
||||
template<>
|
||||
Value EvaluationFunction<KmmKm>::apply(const Position&) {
|
||||
return Value(0);
|
||||
}
|
||||
|
||||
template<>
|
||||
Value EvaluationFunction<KNNK>::apply(const Position&) {
|
||||
return Value(0);
|
||||
}
|
||||
|
||||
/// KBPKScalingFunction scales endgames where the stronger side has king,
|
||||
/// bishop and one or more pawns. It checks for draws with rook pawns and a
|
||||
|
|
|
@ -45,6 +45,7 @@ enum EndgameType {
|
|||
KRKN, // KR vs KN
|
||||
KQKR, // KQ vs KR
|
||||
KBBKN, // KBB vs KN
|
||||
KNNK, // KNN vs K
|
||||
KmmKm, // K and two minors vs K and one or two minors
|
||||
|
||||
// Scaling functions
|
||||
|
|
|
@ -61,8 +61,6 @@ namespace {
|
|||
ScalingFunction<KQKRP> ScaleKQKRP(WHITE), ScaleKRPKQ(BLACK);
|
||||
ScalingFunction<KPsK> ScaleKPsK(WHITE), ScaleKKPs(BLACK);
|
||||
ScalingFunction<KPKP> ScaleKPKPw(WHITE), ScaleKPKPb(BLACK);
|
||||
|
||||
Key KNNKMaterialKey, KKNNMaterialKey;
|
||||
}
|
||||
|
||||
|
||||
|
@ -157,14 +155,6 @@ MaterialInfo* MaterialInfoTable::get_material_info(const Position& pos) {
|
|||
mi->clear();
|
||||
mi->key = key;
|
||||
|
||||
// A special case before looking for a specialized evaluation function
|
||||
// KNN vs K is a draw.
|
||||
if (key == KNNKMaterialKey || key == KKNNMaterialKey)
|
||||
{
|
||||
mi->factor[WHITE] = mi->factor[BLACK] = 0;
|
||||
return mi;
|
||||
}
|
||||
|
||||
// Let's look if we have a specialized evaluation function for this
|
||||
// particular material configuration. First we look for a fixed
|
||||
// configuration one, then a generic one if previous search failed.
|
||||
|
@ -348,9 +338,7 @@ MaterialInfo* MaterialInfoTable::get_material_info(const Position& pos) {
|
|||
|
||||
EndgameFunctions::EndgameFunctions() {
|
||||
|
||||
KNNKMaterialKey = buildKey("KNNK");
|
||||
KKNNMaterialKey = buildKey("KKNN");
|
||||
|
||||
add<EvaluationFunction<KNNK> >("KNNK");
|
||||
add<EvaluationFunction<KPK> >("KPK");
|
||||
add<EvaluationFunction<KBNK> >("KBNK");
|
||||
add<EvaluationFunction<KRKP> >("KRKP");
|
||||
|
|
Loading…
Add table
Reference in a new issue