X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fendgame.cpp;h=97274946b00c243e50852fd854b8ca8c52f25953;hp=348feecf70bf5e170211460a23145a55749610dd;hb=a617b038759f6abd1b33f71ef6d1938fa3588c3d;hpb=324ca87affc4959f7017e83437fb06b6e770449c diff --git a/src/endgame.cpp b/src/endgame.cpp index 348feecf..97274946 100644 --- a/src/endgame.cpp +++ b/src/endgame.cpp @@ -26,6 +26,7 @@ #include "bitcount.h" #include "endgame.h" +#include "pawns.h" //// @@ -402,7 +403,7 @@ ScaleFactor ScalingFunction::apply(const Position& pos) const { Square kingSq = pos.king_square(weakerSide); if ( opposite_color_squares(queeningSq, bishopSq) - && file_distance(square_file(kingSq), pawnFile) <= 1) + && abs(square_file(kingSq) - pawnFile) <= 1) { // 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 @@ -769,7 +770,7 @@ ScaleFactor ScalingFunction::apply(const Position& pos) const { && opposite_color_squares(ksq, wbsq) && ( bbsq == blockSq2 || (pos.attacks_from(blockSq2) & pos.pieces(BISHOP, weakerSide)) - || rank_distance(r1, r2) >= 2)) + || abs(r1 - r2) >= 2)) return SCALE_FACTOR_ZERO; else if ( ksq == blockSq2