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§
source§impl<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.
source§impl 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§
source§impl<T: Clone> Clone for MaybeRounded<T>
impl<T: Clone> Clone for MaybeRounded<T>
source§fn clone(&self) -> MaybeRounded<T>
fn clone(&self) -> MaybeRounded<T>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more