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§
source§impl 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§
source§impl Ord for Dtz
impl Ord for Dtz
source§impl PartialOrd<Dtz> for Dtz
impl PartialOrd<Dtz> for Dtz
1.0.0 · source§fn 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