-/// KNP vs K. There is a single rule: if the pawn is a rook pawn on the 7th rank
-/// and the defending king prevents the pawn from advancing, the position is drawn.
-template<>
-ScaleFactor Endgame<KNPK>::operator()(const Position& pos) const {
-
- assert(verify_material(pos, strongSide, KnightValueMg, 1));
- assert(verify_material(pos, weakSide, VALUE_ZERO, 0));
-
- // Assume strongSide is white and the pawn is on files A-D
- Square pawnSq = normalize(pos, strongSide, pos.square<PAWN>(strongSide));
- Square weakKingSq = normalize(pos, strongSide, pos.square<KING>(weakSide));
-
- if (pawnSq == SQ_A7 && distance(SQ_A8, weakKingSq) <= 1)
- return SCALE_FACTOR_DRAW;
-
- return SCALE_FACTOR_NONE;
-}
-
-
-/// KNP vs KB. If knight can block bishop from taking pawn, it's a win.
-/// Otherwise the position is drawn.
-template<>
-ScaleFactor Endgame<KNPKB>::operator()(const Position& pos) const {
-
- assert(verify_material(pos, strongSide, KnightValueMg, 1));
- assert(verify_material(pos, weakSide, BishopValueMg, 0));
-
- Square pawnSq = pos.square<PAWN>(strongSide);
- Square bishopSq = pos.square<BISHOP>(weakSide);
- Square weakKingSq = pos.square<KING>(weakSide);
-
- // King needs to get close to promoting pawn to prevent knight from blocking.
- // Rules for this are very tricky, so just approximate.
- if (forward_file_bb(strongSide, pawnSq) & pos.attacks_from<BISHOP>(bishopSq))
- return ScaleFactor(distance(weakKingSq, pawnSq));
-
- return SCALE_FACTOR_NONE;
-}
-
-