X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fsearch.cpp;h=44e13dae8d386f74a8a95f6aa4436b5c3b09d15a;hb=b7b7a3f3fa786449832bd84d501c1183290f3e3a;hp=03d72b95373b412a543cf72641893817c5351348;hpb=222f3ea55bab2414c4c260391ffd14dabc1684df;p=stockfish diff --git a/src/search.cpp b/src/search.cpp index 03d72b95..44e13dae 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -1410,6 +1410,18 @@ moves_loop: // When in check, search starts here assert(PvNode || (alpha == beta - 1)); assert(depth <= 0); + // Check if we have an upcoming move that draws by repetition, or + // if the opponent had an alternative move earlier to this position. + if ( depth < 0 + && pos.rule50_count() >= 3 + && alpha < VALUE_DRAW + && pos.has_game_cycle(ss->ply)) + { + alpha = value_draw(pos.this_thread()); + if (alpha >= beta) + return alpha; + } + Move pv[MAX_PLY+1]; StateInfo st; ASSERT_ALIGNED(&st, Eval::NNUE::CacheLineSize);