Enum shakmaty_syzygy::MaybeRounded
source · [−]pub enum MaybeRounded<T> {
Rounded(T),
Precise(T),
}
Expand description
A value that may be affected by DTZ rounding.
DTZ
Rounded Dtz
values may be off by one:
MaybeRounded::Rounded(Dtz(-n))
can mean a loss with a forced zeroing move inn
orn + 1
plies.MaybeRounded::Rounded(Dtz(n))
can mean a win with a forced zeroing move inn
orn + 1
plies.
WDL
Because of that MaybeRounded::Rounded(Dtz(100))
might correspond to
Wdl::Win
or Wdl::CursedWin
, and MaybeRounded::Rounded(Dtz(-100))
might correspond to Wdl::Loss
or Wdl::BlessedLoss
.
Rounding will never be used for endgame phases that are exactly on the edge of the 50-move rule (value ±100 directly after a capture or pawn move).
Move selection
So some primary tablebase lines may waste up to 1 ply, but never more, and never for endgame phases (starting after a capture or pawn move) where wasting 1 ply would change the game theoretical outcome.
Users need to be careful in positions that are nearly drawn under the 50-move rule! Carelessly wasting 1 more ply by not following the tablebase recommendation, for a total of 2 wasted plies, may change the outcome of the game afterall.
For some background, see this and the following posts on talkchess.com.
Variants
Rounded(T)
Inner value potentially affected by DTZ rounding.
Precise(T)
Inner value not affected by DTZ rounding.
Implementations
sourceimpl<T> MaybeRounded<T>
impl<T> MaybeRounded<T>
sourcepub fn map<U, F>(self, f: F) -> MaybeRounded<U> where
F: FnOnce(T) -> U,
pub fn map<U, F>(self, f: F) -> MaybeRounded<U> where
F: FnOnce(T) -> U,
Applies a function to the inner value.
sourcepub fn ignore_rounding(self) -> T
pub fn ignore_rounding(self) -> T
Gets the inner value.
sourceimpl MaybeRounded<Dtz>
impl MaybeRounded<Dtz>
sourcepub fn is_zero(self) -> bool
pub fn is_zero(self) -> bool
See Dtz::is_zero()
.
sourcepub fn is_positive(self) -> bool
pub fn is_positive(self) -> bool
See Dtz::is_positive()
.
sourcepub fn is_negative(self) -> bool
pub fn is_negative(self) -> bool
See Dtz::is_negative()
.
sourcepub fn signum(self) -> i32
pub fn signum(self) -> i32
See Dtz::signum()
.
sourcepub fn add_plies(self, plies: u32) -> MaybeRounded<Dtz>
pub fn add_plies(self, plies: u32) -> MaybeRounded<Dtz>
See Dtz::add_plies()
.
sourcepub fn add_plies_checked(self, plies: u32) -> MaybeRounded<Option<Dtz>>
pub fn add_plies_checked(self, plies: u32) -> MaybeRounded<Option<Dtz>>
sourcepub fn add_plies_saturating(self, plies: u32) -> MaybeRounded<Dtz>
pub fn add_plies_saturating(self, plies: u32) -> MaybeRounded<Dtz>
Trait Implementations
sourceimpl<T: Clone> Clone for MaybeRounded<T>
impl<T: Clone> Clone for MaybeRounded<T>
sourcefn clone(&self) -> MaybeRounded<T>
fn clone(&self) -> MaybeRounded<T>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<T: Debug> Debug for MaybeRounded<T>
impl<T: Debug> Debug for MaybeRounded<T>
sourceimpl<T: Neg> Neg for MaybeRounded<T>
impl<T: Neg> Neg for MaybeRounded<T>
impl<T: Copy> Copy for MaybeRounded<T>
Auto Trait Implementations
impl<T> RefUnwindSafe for MaybeRounded<T> where
T: RefUnwindSafe,
impl<T> Send for MaybeRounded<T> where
T: Send,
impl<T> Sync for MaybeRounded<T> where
T: Sync,
impl<T> Unpin for MaybeRounded<T> where
T: Unpin,
impl<T> UnwindSafe for MaybeRounded<T> where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more