From 1bdbfd472a937ce1aa95ec98ae90c5a8f49c8477 Mon Sep 17 00:00:00 2001 From: Niklas Fiekas Date: Tue, 31 Dec 2024 10:59:04 +0100 Subject: [PATCH] improve docs --- src/lib.rs | 4 ++-- src/tablebase.rs | 10 ++++++---- src/types.rs | 18 ++++++++---------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 8e223cc..ceb8006 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,8 +1,8 @@ //! Probe Syzygy endgame tablebases. //! //! [Syzygy tables](https://syzygy-tables.info/#syzygy) allow optimal play -//! under the 50-move rule. Tables are available for positions with up to -//! 7 pieces. +//! with and without regard to the 50-move rule. +//! Tables are available for positions with up to 7 pieces. //! //! # Example //! diff --git a/src/tablebase.rs b/src/tablebase.rs index 8914a04..6898680 100644 --- a/src/tablebase.rs +++ b/src/tablebase.rs @@ -158,7 +158,7 @@ impl Tablebase { /// Returns an immediate error result when: /// /// * The filename does not indicate that it is a valid table file - /// (e.g. `KQvKP.rtbz`). + /// (e.g., `KQvKP.rtbz`). /// * Querying metadata for the path fails (file does not exist, /// broken symlink, no permission to read metadata, ...). /// * `path` is not pointing to a regular file. @@ -244,6 +244,8 @@ impl Tablebase { /// Probe tables for the [`Wdl`] value of a position, assuming `pos` /// is reached directly after a capture or pawn move. /// + /// Requires only WDL tables. + /// /// # Errors /// /// See [`SyzygyError`] for possible error conditions. @@ -285,7 +287,7 @@ impl Tablebase { /// Following the tablebase mainline *starting from a capture or pawn move* /// guarantees achieving the optimal outcome under the 50-move rule. /// - /// Otherwise (i.e. when not immediately following the tablebase mainline + /// Otherwise (i.e., when not immediately following the tablebase mainline /// after the capture that crosses into tablebase territory), /// [some care needs to be taken due to DTZ rounding](MaybeRounded). /// @@ -389,8 +391,8 @@ impl Tablebase { // (1) Resolving en passant captures. // // (2) When a position has a capture that achieves a particular result - // (e.g. there is a winning capture), then the position itself - // should have at least that value (e.g. it is winning). In this + // (e.g., there is a winning capture), then the position itself + // should have at least that value (e.g., it is winning). In this // case the table can store an arbitrary lower value, whichever is // best for compression. // diff --git a/src/types.rs b/src/types.rs index e600b86..4ffb3f6 100644 --- a/src/types.rs +++ b/src/types.rs @@ -99,17 +99,15 @@ impl Syzygy for shakmaty::variant::Antichess { /// # DTZ /// /// Rounded [`Dtz`] values may be off by one: -/// -/// * `MaybeRounded::Rounded(Dtz(-n))` can mean a loss with a forced -/// zeroing move in `n` or `n + 1` plies. -/// * `MaybeRounded::Rounded(Dtz(n))` can mean a win with a forced -/// zeroing move in `n` or `n + 1` plies. +/// `MaybeRounded::Rounded(Dtz(n))` can mean `Dtz(n)` or `Dtz(n).add_plies(1)`. /// /// # 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`]. +/// Because of that, +/// `MaybeRounded::Rounded(Dtz(100))` might correspond to +/// [`Wdl::Win`] or [`Wdl::CursedWin`] ([`AmbiguousWdl::MaybeWin`]), and +/// `MaybeRounded::Rounded(Dtz(-100))` might correspond to +/// [`Wdl::Loss`] or [`Wdl::BlessedLoss`] ([`AmbiguousWdl::MaybeLoss`]). /// /// 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 @@ -119,7 +117,7 @@ impl Syzygy for shakmaty::variant::Antichess { /// /// 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. +/// 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 @@ -482,7 +480,7 @@ impl From for AmbiguousWdl { /// DTZ50′′. Based on the distance to zeroing of the /// half-move clock. /// -/// Zeroing the half-move clock while keeping the game theoretical result in +/// 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. ///