Skip to content

Commit

Permalink
try making exact bounds in qsearch
Browse files Browse the repository at this point in the history
  • Loading branch information
claytonwramsey committed Aug 3, 2023
1 parent 3a972a9 commit 8bf474d
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/engine/search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ impl<'a> PVSearch<'a> {
moves.push(TaggedMove::new(&self.game, m, state.mg_npm));
});
moves.sort_by_cached_key(|tm| -tm.quality);

let mut overwrote_alpha = false;
for tm in moves {
let mut new_state = NodeState {
depth_since_root: state.depth_since_root + 1,
Expand Down Expand Up @@ -608,6 +608,7 @@ impl<'a> PVSearch<'a> {
}

alpha = score;
overwrote_alpha = true;
}
}
}
Expand All @@ -616,7 +617,13 @@ impl<'a> PVSearch<'a> {
TTEntry::DEPTH_CAPTURES,
best_move,
best_score.step_forward_by(state.depth_since_root),
BoundType::Lower,
if best_score >= beta {
BoundType::Lower
} else if PV && overwrote_alpha {
BoundType::Exact
} else {
BoundType::Upper
},
);
Ok(best_score)
}
Expand Down

0 comments on commit 8bf474d

Please sign in to comment.