diff --git a/src/search.cpp b/src/search.cpp index 87bedbc8..73396ed1 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -415,7 +415,29 @@ Value Worker::search( && (tt_data->bound() == Bound::Exact || (tt_data->bound() == Bound::Lower && tt_data->score >= beta) || (tt_data->bound() == Bound::Upper && tt_data->score <= alpha))) { - return tt_data->score; + if (depth <= 7) { + return tt_data->score; + } + + if (tt_data->move == Move::none()) { + return tt_data->score; + } + + MoveGen movegen{pos}; + + if (movegen.is_legal(tt_data->move)) { + Position pos_after = pos.move(tt_data->move, m_td.push_psqt_state()); + auto tt_data_after = m_searcher.tt.probe(pos_after, ply); + m_td.pop_psqt_state(); + + if (!tt_data_after) { + return tt_data->score; + } + + if ((tt_data->score >= beta) == (tt_data_after->score <= -beta)) { + return tt_data->score; + } + } } // Update ttpv