X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fendgame.cpp;h=e0efd0e665271b75f2fc6bab5b824b97f843de89;hp=bb756f3b20cd558922c4fc6c416b055e962c3b6d;hb=15153a1de71d2d36c1f95eecfcf036fb76565309;hpb=469e7c5143af0785d6ba41cdef731ac1f403141c diff --git a/src/endgame.cpp b/src/endgame.cpp index bb756f3b..e0efd0e6 100644 --- a/src/endgame.cpp +++ b/src/endgame.cpp @@ -699,11 +699,12 @@ ScaleFactor ScalingFunction::apply(const Position& pos) const { return SCALE_FACTOR_ZERO; else { - Bitboard ray = ray_bb(pawnSq, (strongerSide == WHITE)? SIGNED_DIR_N : SIGNED_DIR_S); - if (ray & pos.pieces(KING, weakerSide)) + Bitboard path = squares_in_front_of(strongerSide, pawnSq); + + if (path & pos.pieces(KING, weakerSide)) return SCALE_FACTOR_ZERO; - if ( (pos.attacks_from(weakerBishopSq) & ray) + if ( (pos.attacks_from(weakerBishopSq) & path) && square_distance(weakerBishopSq, pawnSq) >= 3) return SCALE_FACTOR_ZERO; }