-ScaleFactor ScalingFunction<KRPKR>::apply(const Position &pos) {
-
- assert(pos.non_pawn_material(strongerSide) == RookValueMidgame);
- assert(pos.piece_count(strongerSide, PAWN) == 1);
- assert(pos.non_pawn_material(weakerSide) == RookValueMidgame);
- assert(pos.piece_count(weakerSide, PAWN) == 0);
-
- Square wksq = pos.king_square(strongerSide);
- Square wrsq = pos.piece_list(strongerSide, ROOK, 0);
- Square wpsq = pos.piece_list(strongerSide, PAWN, 0);
- Square bksq = pos.king_square(weakerSide);
- Square brsq = pos.piece_list(weakerSide, ROOK, 0);
-
- // Orient the board in such a way that the stronger side is white, and the
- // pawn is on the left half of the board.
- if (strongerSide == BLACK)
- {
- wksq = flip_square(wksq);
- wrsq = flip_square(wrsq);
- wpsq = flip_square(wpsq);
- bksq = flip_square(bksq);
- brsq = flip_square(brsq);
- }
- if (square_file(wpsq) > FILE_D)
- {
- wksq = flop_square(wksq);
- wrsq = flop_square(wrsq);
- wpsq = flop_square(wpsq);
- bksq = flop_square(bksq);
- brsq = flop_square(brsq);
- }
+ScaleFactor Endgame<KRPKR>::operator()(const Position& pos) const {
+
+ assert(verify_material(pos, strongSide, RookValueMg, 1));
+ assert(verify_material(pos, weakSide, RookValueMg, 0));