From ac4239c109d95064753d8db1b05670089ef8437e Mon Sep 17 00:00:00 2001 From: Danny Hammer Date: Mon, 6 Jan 2025 20:11:38 -0700 Subject: [PATCH] refactor: updated uci-parser details bench: 8240023 --- Cargo.lock | 4 ++-- Cargo.toml | 4 ++-- src/engine.rs | 10 +++++----- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c5bcbe8..736c293 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -231,8 +231,8 @@ dependencies = [ [[package]] name = "uci-parser" -version = "0.2.0" -source = "git+https://github.com/dannyhammer/uci-parser.git#8fc724cd30cb136d18050470da9ba93c75082042" +version = "1.0.0" +source = "git+https://github.com/dannyhammer/uci-parser.git#4559d15e8b77988736e76a5aaa29cc2fc910795a" dependencies = [ "nom", "thiserror 1.0.69", diff --git a/Cargo.toml b/Cargo.toml index cec8cc9..42b3ff0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,6 +14,6 @@ anyhow = "1.0.89" arrayvec = "0.7.6" clap = { version = "4.5.18", features = ["derive", "string"] } thiserror = "2.0.7" -#uci-parser = { path = "../../uci-parser", features = ["parse-go-perft", "parse-position-kiwipete", "clamp-negatives", "err-on-unused-input"] } +#uci-parser = { path = "../uci-parser", features = ["parse-go-perft", "parse-position-kiwipete", "clamp-negatives", "err-on-unused-input"] } uci-parser = { git = "https://github.com/dannyhammer/uci-parser.git", features = ["parse-go-perft", "parse-position-kiwipete", "clamp-negatives", "err-on-unused-input"] } -#uci-parser = { version = "0.2.0", features = ["parse-go-perft", "parse-position-kiwipete", "clamp-negatives", "err-on-unused-input"] } \ No newline at end of file +#uci-parser = { version = "3.0.0", features = ["parse-go-perft", "parse-position-kiwipete", "clamp-negatives", "err-on-unused-input"] } \ No newline at end of file diff --git a/src/engine.rs b/src/engine.rs index cfae4b3..d13e635 100644 --- a/src/engine.rs +++ b/src/engine.rs @@ -278,7 +278,7 @@ impl Engine { Debug(status) => self.debug = status, - IsReady => println!("{}", UciResponse::<&str>::ReadyOk), + IsReady => println!("{}", UciResponse::readyok()), SetOption { name, value } => self.set_option(&name, value)?, @@ -654,15 +654,15 @@ impl Engine { /// /// Prints engine's ID, version, and authors, and lists all UCI options. fn uci(&self) { - println!("id name {}\nid author {}\n", self.name(), self.authors()); + println!("{}", UciResponse::Name(self.name())); + println!("{}\n", UciResponse::Name(self.authors())); // Print all UCI options for opt in self.options() { println!("{}", UciResponse::Option(opt)); } - // We're ready to go! - println!("{}", UciResponse::<&str>::UciOk) + println!("{}", UciResponse::uciok()); } /// Convenience function to return an iterator over all UCI options this engine supports. @@ -804,7 +804,7 @@ impl Engine { /// Helper to send a [`UciInfo`] containing only a `string` message to `stdout`. #[inline(always)] fn send_string(info: T) { - let resp = UciResponse::::Info(Box::new(UciInfo::new().string(info))); + let resp = UciResponse::info(UciInfo::new().string(info)); println!("{resp}"); }