[−][src]Crate usi
Types representing commands defined in USI protocol.
USI protocol defines commands sent from either GUIs or engines. Detail about USI protocol is found at http://www.geocities.jp/shogidokoro/usi.html.
Examples
use std::time::Duration; use usi::{GuiCommand, ThinkParams, EngineCommand, BestMoveParams}; // GuiCommand can be converted into the USI compliant string. let params = ThinkParams::new().btime(Duration::from_secs(1)).wtime(Duration::from_secs(2)); let cmd = GuiCommand::Go(params); assert_eq!("go btime 1000 wtime 2000", cmd.to_string()); // EngineCommand can be parsed from the command string sent from the USI engine. let cmd = EngineCommand::parse("bestmove 7g7f ponder 8c8d").unwrap(); match cmd { EngineCommand::BestMove(BestMoveParams::MakeMove(ref m, Some(ref pm))) => { assert_eq!("7g7f", *m); assert_eq!("8c8d", *pm); }, _ => unreachable!(), }
Structs
OptionParams | Represents parameters of "option" command. |
ThinkParams | Represents parameters of "go" command. |
Enums
BestMoveParams | Represents parameters of "bestmove" command. |
CheckmateParams | Represents parameters of "checkmate" command. |
EngineCommand | Represents a USI command sent from the engine. |
Error | The error type for USI command conversions. |
GameOverKind | Represents parameters of "gameover" command. |
GuiCommand | Represents a USI command sent from the GUI. |
IdParams | Represents parameters of "id" command. |
InfoParams | Represents parameters of "info" command. |
OptionKind | Represents a kind of "option" command value. |
ScoreKind | Represents a kind of "score" parameter value in "info" command. |