Struct shakmaty_syzygy::Dtz
source · [−]pub struct Dtz(pub i32);
Expand description
DTZ50′′. Based on the distance to zeroing of the half-move clock.
Zeroing the half-move clock while keeping the game theoretical result in
hand guarantees making progress, so min-maxing Dtz
values guarantees
achieving the optimal outcome under the 50-move rule.
DTZ | WDL | |
---|---|---|
-100 <= n <= -1 | Loss | Unconditional loss (assuming the 50-move counter is zero). Zeroing move can be forced in -n plies. |
n < -100 | Blessed loss | Loss, but draw under the 50-move rule. A zeroing move can be forced in -n plies or -n - 100 plies (if a later phase is responsible for the blessing). |
0 | Draw | |
100 < n | Cursed win | Win, but draw under the 50-move rule. A zeroing move can be forced in n or n - 100 plies (if a later phase is responsible for the curse). |
1 <= n <= 100 | Win | Unconditional win (assuming the 50-move counter is zero). Zeroing move can be forced in n plies. |
Tuple Fields
0: i32
Implementations
sourceimpl Dtz
impl Dtz
sourcepub fn before_zeroing(wdl: Wdl) -> Dtz
pub fn before_zeroing(wdl: Wdl) -> Dtz
Converts wdl
to a Dtz
, given that the best move is zeroing.
WDL | DTZ |
---|---|
Loss | -1 |
Blessed loss | -101 |
Draw | 0 |
Cursed win | 101 |
Win | 1 |
sourcepub fn add_plies_checked(self, plies: u32) -> Option<Dtz>
pub fn add_plies_checked(self, plies: u32) -> Option<Dtz>
Increases the absolute non-zero value by plies
, returning None
if overflow occurred.
sourcepub fn add_plies_saturating(self, plies: u32) -> Dtz
pub fn add_plies_saturating(self, plies: u32) -> Dtz
Increases the absolute non-zero value by plies
, saturating if
overflow occurred.
sourcepub fn signum(self) -> i32
pub fn signum(self) -> i32
Returns a number representing the sign of self
.
1
ifself > Dtz(0)
0
ifself == Dtz(0)
-1
ifself < Dtz(0)
sourcepub fn is_positive(self) -> bool
pub fn is_positive(self) -> bool
Returns self > Dtz(0)
.
sourcepub fn is_negative(self) -> bool
pub fn is_negative(self) -> bool
Returns self < Dtz(0)
.
Trait Implementations
sourceimpl Ord for Dtz
impl Ord for Dtz
1.21.0 · sourcefn max(self, other: Self) -> Self
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
1.21.0 · sourcefn min(self, other: Self) -> Self
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Self where
Self: PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Self where
Self: PartialOrd<Self>,
Restrict a value to a certain interval. Read more
sourceimpl PartialOrd<Dtz> for Dtz
impl PartialOrd<Dtz> for Dtz
sourcefn partial_cmp(&self, other: &Dtz) -> Option<Ordering>
fn partial_cmp(&self, other: &Dtz) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl Copy for Dtz
impl Eq for Dtz
impl StructuralEq for Dtz
impl StructuralPartialEq for Dtz
Auto Trait Implementations
impl RefUnwindSafe for Dtz
impl Send for Dtz
impl Sync for Dtz
impl Unpin for Dtz
impl UnwindSafe for Dtz
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