~alip/jja

6f564fa7b1397a6ad8b237ea92bab5197a6c62b2 — Ali Polatel 11 months ago f15b486
make: support TotalPlyCount as a PGN tag filter
4 files changed, 9 insertions(+), 3 deletions(-)

M README-de.md
M README.md
M src/main.rs
M src/pgnfilt.rs
M README-de.md => README-de.md +1 -1
@@ 271,7 271,7 @@ Beispiel:

Unterstützte Tags sind Event, Site, Date, UTCDate, Round, Black, White, Result,
BlackElo, WhiteElo, BlackRatingDiff, WhiteRatingDiff, BlackTitle, WhiteTitle,
ECO, Opening, TimeControl, Termination und ScidFlags.
ECO, Opening, TimeControl, Termination, TotalPlyCount und ScidFlags.

Zusätzlich gibt es vier spezielle Variablen, nämlich Player, Elo, Title und
RatingDiff. Diese Variablen können verwendet werden, um den entsprechenden

M README.md => README.md +2 -1
@@ 272,7 272,7 @@ Example:

Supported tags are Event, Site, Date, UTCDate, Round, Black, White, Result,
BlackElo, WhiteElo, BlackRatingDiff, WhiteRatingDiff, BlackTitle, WhiteTitle, ECO,
Opening, TimeControl, Termination, and ScidFlags.
Opening, TimeControl, Termination, TotalPlyCount, and ScidFlags.

In addition to these are four special variables, namely, Player, Elo, Title, and
RatingDiff. These variables may be used to match the relevant header from either


@@ 385,6 385,7 @@ chessboard displaying code in [PolyGlot](http://hgm.nubati.net/book_format.html)

## ?

- `TotalPlyCount` PGN tag is now supported in make filters.
- fix `--win,draw,loss-factor` calculation for make
- Add 50-moves detection and 3-position repetition detection to the play
  subcommand.

M src/main.rs => src/main.rs +1 -1
@@ 852,7 852,7 @@ Example:

Supported tags are Event, Site, Date, UTCDate, Round, Black, White, Result,
BlackElo, WhiteElo, BlackRatingDiff, WhiteRatingDiff, BlackTitle, WhiteTitle,
ECO, Opening, TimeControl, Termination, and ScidFlags.
ECO, Opening, TimeControl, Termination, TotalPlyCount, and ScidFlags.

In addition to these are four special variables, namely, Player, Elo, Title, and
RatingDiff. These variables may be used to match the relevant header from either

M src/pgnfilt.rs => src/pgnfilt.rs +5 -0
@@ 62,6 62,8 @@ pub enum Field {
    TimeControl,
    /// The manner in which the game was terminated (e.g., checkmate, draw by agreement).
    Termination,
    /// Total number of plies in the game.
    TotalPlyCount,
    /// Game flags added by the SCID software (DWBMENPTKQ!?U123456)
    ScidFlags,
}


@@ 182,6 184,7 @@ impl FromStr for Field {
            "Opening" => Ok(Field::Opening),
            "TimeControl" => Ok(Field::TimeControl),
            "Termination" => Ok(Field::Termination),
            "TotalPlyCount" => Ok(Field::TotalPlyCount),
            "ScidFlags" => Ok(Field::ScidFlags),
            _ => Err(()),
        }


@@ 253,6 256,7 @@ impl fmt::Display for Field {
            Field::Opening => "Opening",
            Field::TimeControl => "TimeControl",
            Field::Termination => "Termination",
            Field::TotalPlyCount => "TotalPlyCount",
            Field::ScidFlags => "ScidFlags",
        };
        write!(f, "{}", field_str)


@@ 281,6 285,7 @@ impl Field {
            b"Opening" => Some(Field::Opening),
            b"TimeControl" => Some(Field::TimeControl),
            b"Termination" => Some(Field::Termination),
            b"TotalPlyCount" => Some(Field::TotalPlyCount),
            b"ScidFlags" => Some(Field::ScidFlags),
            _ => None,
        }