From eacc748137d13f41ff34311571910797d8557d88 Mon Sep 17 00:00:00 2001 From: Adarsh Das Date: Sat, 6 Jun 2026 20:21:01 +0530 Subject: [PATCH] Stop search on finding mated in 2, mate in 1 or mate in 2 Implementation of: https://github.com/official-stockfish/Stockfish/pull/6879 Bench: 3204302 Co-authored-by: Robert Nurnberg <28635489+robertnurnberg@users.noreply.github.com> --- src/search.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/search.rs b/src/search.rs index 984fc3b71..79d283e54 100644 --- a/src/search.rs +++ b/src/search.rs @@ -269,7 +269,10 @@ pub fn start(td: &mut ThreadData, report: Report, thread_count: usize) { td.shared.soft_stop_votes.fetch_sub(1, Ordering::AcqRel); } - if td.shared.status.get() == Status::STOPPED { + if td.shared.status.get() == Status::STOPPED + || (!matches!(td.time_manager.limits(), Limits::Infinite) + && (td.root_moves[0].score == mated_in(2) || td.root_moves[td.multi_pv - 1].score >= mate_in(3))) + { break; } }