#shogi #string #conversion #engine #error #usi #format

no-std shogi_usi_parser

Conversion from strings in USI format

1 unstable release

0.1.0 May 24, 2022

#1725 in Game dev

Download history 3/week @ 2024-11-13 5/week @ 2024-11-20 1/week @ 2024-11-27 7/week @ 2024-12-04 18/week @ 2024-12-11 5/week @ 2024-12-18 3/week @ 2025-01-01 8/week @ 2025-01-08 10/week @ 2025-01-15 9/week @ 2025-01-22 7/week @ 2025-01-29 97/week @ 2025-02-05 51/week @ 2025-02-12 2/week @ 2025-02-19 20/week @ 2025-02-26

173 downloads per month
Used in 2 crates

MIT license

37KB
670 lines

Rust shogi crates: USI parser (rlib)

crate docs Rust Version license

This repository handles conversion from strings in USI format defined in the spec.

About shogi_usi_parser crate

This crate provides methods that convert USI strings to data. For example, it can convert following strings:

as PartialPosition:

lnsgkgsnl/1r5b1/ppppppppp/9/9/9/PPPPPPPPP/1B5R1/LNSGKGSNL b - 1

as Position:

startpos moves 7g7f

(excerpt from https://web.archive.org/web/20080131070731/http://www.glaurungchess.com/shogi/usi.html)

For conversion, this crate defines the following traits and data types:

  • A trait responsible for conversion from strings in USI format to Self. Implementors of this trait provides a method that reports detailed error reports, and a method that reports only whether an error occurred.
  • Error: An error type for conversion. Some possible errors are the following:
    • The string representation is invalid (e.g. 9j is given as a square).
    • The parsed position is invalid.

What are out of scope?

  • Failing to convert to a Position when the parser encountered illegal moves
    • Other crates are responsible for legality checking

Dependencies

~165KB