- Square pawnSq = pos.square<PAWN>(strongSide);
- Square strongBishopSq = pos.square<BISHOP>(strongSide);
- Square weakKingSq = pos.square<KING>(weakSide);
-
- if ( file_of(weakKingSq) == file_of(pawnSq)
- && relative_rank(strongSide, pawnSq) < relative_rank(strongSide, weakKingSq)
- && ( opposite_colors(weakKingSq, strongBishopSq)
- || relative_rank(strongSide, weakKingSq) <= RANK_6))
- return SCALE_FACTOR_DRAW;
-
- return SCALE_FACTOR_NONE;
-}
-
-
-/// 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));