X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fendgame.cpp;h=d9961622e043f93f669a83cbd4d489aaa1389fc7;hp=a8c1e1d01ffb4d4803fbc1a957bd25366a2b85a7;hb=bfd4421f490e721958a77b8304d8ebcb574a583f;hpb=297c12e595ebc33e11be73ee4b188326418acb4f diff --git a/src/endgame.cpp b/src/endgame.cpp index a8c1e1d0..d9961622 100644 --- a/src/endgame.cpp +++ b/src/endgame.cpp @@ -348,11 +348,18 @@ Value EvaluationFunction::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::apply(const Position&) { return Value(0); } +template<> +Value EvaluationFunction::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 @@ -360,7 +367,7 @@ Value EvaluationFunction::apply(const Position&) { /// returned. If not, the return value is SCALE_FACTOR_NONE, i.e. no scaling /// will be used. template<> -ScaleFactor ScalingFunction::apply(const Position& pos) { +ScaleFactor ScalingFunction::apply(const Position& pos) { assert(pos.non_pawn_material(strongerSide) == BishopValueMidgame); assert(pos.piece_count(strongerSide, BISHOP) == 1); @@ -386,7 +393,6 @@ ScaleFactor ScalingFunction::apply(const Position& pos) { // The bishop has the wrong color, and the defending king is on the // file of the pawn(s) or the neighboring file. Find the rank of the // frontmost pawn. - Rank rank; if (strongerSide == WHITE) { @@ -415,7 +421,7 @@ ScaleFactor ScalingFunction::apply(const Position& pos) { /// It tests for fortress draws with a rook on the third rank defended by /// a pawn. template<> -ScaleFactor ScalingFunction::apply(const Position& pos) { +ScaleFactor ScalingFunction::apply(const Position& pos) { assert(pos.non_pawn_material(strongerSide) == QueenValueMidgame); assert(pos.piece_count(strongerSide, QUEEN) == 1);