Skip to content

Commit

Permalink
improve docs
Browse files Browse the repository at this point in the history
  • Loading branch information
niklasf committed Dec 31, 2024
1 parent a7c4bf8 commit 1bdbfd4
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -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
//!
Expand Down
10 changes: 6 additions & 4 deletions src/tablebase.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ impl<S: Position + Clone + Syzygy> Tablebase<S> {
/// 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.
Expand Down Expand Up @@ -244,6 +244,8 @@ impl<S: Position + Clone + Syzygy> Tablebase<S> {
/// 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.
Expand Down Expand Up @@ -285,7 +287,7 @@ impl<S: Position + Clone + Syzygy> Tablebase<S> {
/// 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).
///
Expand Down Expand Up @@ -389,8 +391,8 @@ impl<S: Position + Clone + Syzygy> Tablebase<S> {
// (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.
//
Expand Down
18 changes: 8 additions & 10 deletions src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -482,7 +480,7 @@ impl From<Wdl> for AmbiguousWdl {
/// DTZ<sub>50</sub>′′. 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.
///
Expand Down

0 comments on commit 1bdbfd4

Please sign in to comment.