+Value Endgame<KRKN>::operator()(const Position& pos) const {
+
+ assert(pos.non_pawn_material(strongerSide) == RookValueMg);
+ assert(pos.non_pawn_material(weakerSide ) == KnightValueMg);
+ assert(pos.count<KNIGHT>(weakerSide ) == 1);
+ assert(pos.count< PAWN>(weakerSide ) == 0);
+ assert(pos.count< PAWN>(strongerSide) == 0);
+
+ Square bksq = pos.king_square(weakerSide);
+ Square bnsq = pos.list<KNIGHT>(weakerSide)[0];
+ Value result = Value(PushToEdges[bksq] + PushAway[square_distance(bksq, bnsq)]);
+ return strongerSide == pos.side_to_move() ? result : -result;
+}
+
+
+/// KQ vs KP. In general, a win for the stronger side, however, there are a few
+/// important exceptions. Pawn on 7th rank, A,C,F or H file, with king next can
+/// be a draw, so we scale down to distance between kings only.
+template<>
+Value Endgame<KQKP>::operator()(const Position& pos) const {
+
+ assert(pos.non_pawn_material(strongerSide) == QueenValueMg);
+ assert(pos.non_pawn_material(weakerSide ) == VALUE_ZERO);
+ assert(pos.count<PAWN>(strongerSide) == 0);
+ assert(pos.count<PAWN>(weakerSide ) == 1);