Skip to content

Commit

Permalink
Reduce bad captures in main search
Browse files Browse the repository at this point in the history
  • Loading branch information
bdmendes committed May 12, 2024
1 parent c2f342b commit 139ed7d
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/search/pvs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use super::{
constraint::SearchConstraint,
history::BranchHistory,
movepick::MovePicker,
quiesce,
quiesce, see,
table::{ScoreType, SearchTable},
Depth, MAX_DEPTH,
};
Expand Down Expand Up @@ -229,6 +229,18 @@ fn pvs<const ROOT: bool, const MAIN_THREAD: bool, const ALLOW_NMR: bool>(
let late_move_reduction =
if depth > 2 && !is_check && mov.flag().is_quiet() && i > 0 { 1 } else { 0 };

// SEE reduction: we are less interested in captures that are likely to be bad.
let see_reduction = if depth > 2
&& mov.flag().is_capture()
&& !is_check
&& !may_be_zug
&& see::see::<true>(mov, &position.board) < 0
{
depth / 3
} else {
0
};

let mut new_position = position.make_move(mov);

history.visit_position(&new_position, mov.flag().is_reversible());
Expand All @@ -242,7 +254,7 @@ fn pvs<const ROOT: bool, const MAIN_THREAD: bool, const ALLOW_NMR: bool>(
history,
ply,
i > 0,
late_move_reduction,
late_move_reduction + see_reduction,
0,
);
history.leave_position();
Expand Down

0 comments on commit 139ed7d

Please sign in to comment.