Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use crate::{
movepick::{MovePicker, Stage},
stack::Stack,
thread::{RootMove, Status, ThreadData},
time::Limits,
transposition::{Bound, TtDepth},
types::{
ArrayVec, Color, MAX_PLY, Move, Piece, PieceType, Score, Square, draw, is_decisive, is_loss, is_valid, is_win,
Expand Down Expand Up @@ -77,8 +78,13 @@ pub fn start(td: &mut ThreadData, report: Report, thread_count: usize) {
let mut best_move_changes = 0;
let mut soft_stop_voted = false;

let max_depth = match td.time_manager.limits() {
Limits::Depth(maximum) => maximum,
_ => (MAX_PLY - 1) as i32,
};

// Iterative Deepening
for depth in 1..MAX_PLY as i32 {
for depth in 1..=max_depth {
best_move_changes /= 2;

td.sel_depth = 0;
Expand Down
3 changes: 1 addition & 2 deletions src/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ impl TimeManager {

pub fn soft_limit(&self, td: &ThreadData, multiplier: impl Fn() -> f32) -> bool {
match self.limits {
Limits::Infinite => false,
Limits::Depth(maximum) => td.completed_depth >= maximum,
Limits::Infinite | Limits::Depth(_) => false,
Limits::Nodes(maximum) => td.shared.nodes.aggregate() >= maximum,
Limits::Time(maximum) => self.start_time.elapsed() >= Duration::from_millis(maximum),
_ => self.start_time.elapsed() >= Duration::from_secs_f32(self.soft_bound.as_secs_f32() * multiplier()),
Expand Down
Loading