X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fendgame.cpp;h=e0efd0e665271b75f2fc6bab5b824b97f843de89;hp=f9feb00e067b5dd8bd2aa18af4e9ac1f2e28fcbd;hb=d91d6da3c4e9b1346b6a5cf37eb3da852567e4f7;hpb=2feeb206ff3dfa2a8419c4541383afd7eee2e5ed diff --git a/src/endgame.cpp b/src/endgame.cpp index f9feb00e..e0efd0e6 100644 --- a/src/endgame.cpp +++ b/src/endgame.cpp @@ -24,7 +24,6 @@ #include -#include "bitbase.h" #include "bitcount.h" #include "endgame.h" @@ -102,6 +101,7 @@ namespace { /// init_bitbases() is called during program initialization, and simply loads /// bitbases from disk into memory. At the moment, there is only the bitbase /// for KP vs K, but we may decide to add other bitbases later. +extern void generate_kpk_bitbase(uint8_t bitbase[]); void init_bitbases() { generate_kpk_bitbase(KPKBitbase); @@ -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; }