diff --git a/lib/params.rs b/lib/params.rs index 3439016a..c39c1594 100644 --- a/lib/params.rs +++ b/lib/params.rs @@ -233,8 +233,10 @@ params! { fhp_depth_limit: [2.2592714], fhp_margin_scalar: [170.64804, 18.890638], fhp_margin_depth: [19.776033], + razoring_depth_limit: [4.0], razoring_scalar: [30.0234, 21.85148], razoring_depth: [8.186248], + rfp_depth_limit: [12.0], rfp_margin_scalar: [10.407456, 10.813848, -6.300178], rfp_margin_depth: [1.3744049, -0.13397427], rfp_margin_is_improving: [-6.637267], diff --git a/lib/search/engine.rs b/lib/search/engine.rs index 10bcafa3..ce84b86c 100644 --- a/lib/search/engine.rs +++ b/lib/search/engine.rs @@ -636,7 +636,7 @@ impl<'a> Searcher<'a> { if alpha >= beta || upper <= alpha || lower >= beta || ply >= Ply::MAX { return Ok(Pv::empty(stand_pat).clip(lower, upper)); } else if !IS_PV && !is_check { - if !alpha.is_winning() { + if alpha.get().abs() < 1000 && depth < *Params::razoring_depth_limit(0) { let margin = convolve([ (1.0, Params::razoring_scalar(..)), (depth, Params::razoring_depth(..)), @@ -650,7 +650,7 @@ impl<'a> Searcher<'a> { } } - if !beta.is_losing() { + if !beta.is_losing() && depth < *Params::rfp_depth_limit(0) { let margin = convolve([ (1.0, Params::rfp_margin_scalar(..)), (depth, Params::rfp_margin_depth(..)), diff --git a/lib/search/score.rs b/lib/search/score.rs index 24280c77..b292f1ea 100644 --- a/lib/search/score.rs +++ b/lib/search/score.rs @@ -46,13 +46,13 @@ impl Score { Self::new(0) } - /// The tablebase loss score at `ply`. + /// The tablebase losing score at `ply`. #[inline(always)] pub fn losing(ply: Ply) -> Self { Self::mated(Ply::upper()).relative_to_ply(ply) + 1 } - /// The maximum value. + /// The tablebase winning score at `ply`. #[inline(always)] pub fn winning(ply: Ply) -> Self { Self::mating(Ply::upper()).relative_to_ply(ply) - 1 @@ -73,9 +73,9 @@ impl Score { /// Returns number of plies to mate, if one is in the horizon. #[inline(always)] pub fn mate(self) -> Mate { - if self.is_loss() { + if self.is_mated() { Mate::Mated((self - Score::lower()).saturate()) - } else if self.is_win() { + } else if self.is_mating() { Mate::Mating((Score::upper() - self).saturate()) } else { Mate::None @@ -126,21 +126,15 @@ impl Score { /// Returns true if the score represents a won position. #[inline(always)] - pub fn is_win(self) -> bool { + pub fn is_mating(self) -> bool { self > Self::winning(zeroed()) } /// Returns true if the score represents a lost position. #[inline(always)] - pub fn is_loss(self) -> bool { + pub fn is_mated(self) -> bool { self < Self::losing(zeroed()) } - - /// Returns true if the score represents a won or lost position. - #[inline(always)] - pub fn is_decided(self) -> bool { - self.is_win() || self.is_loss() - } } impl Flip for Score { @@ -196,13 +190,13 @@ mod tests { } #[proptest] - fn mating_implies_is_win(p: Ply) { - assert!(Score::mating(p).is_win()); + fn mating_implies_is_mating(p: Ply) { + assert!(Score::mating(p).is_mating()); } #[proptest] - fn mated_implies_is_loss(p: Ply) { - assert!(Score::mated(p).is_loss()); + fn mated_implies_is_mated(p: Ply) { + assert!(Score::mated(p).is_mated()); } #[proptest]