From 039d1601ce5ca1199573db0f39bc0090101cbc7a Mon Sep 17 00:00:00 2001 From: Taylor Bockman Date: Wed, 13 Dec 2017 21:40:59 -0800 Subject: [PATCH] Constants for options.rs --- src/lib.rs | 12 +++++------- src/options.rs | 38 +++++++++++++++++++++++++++++++++++++- 2 files changed, 42 insertions(+), 8 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 51ed4f6..fc706a0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -5,7 +5,7 @@ mod commands; use std::io::{BufRead, Write}; - +use std::vec; #[derive(Debug)] pub struct Engine<'a, R, W> { @@ -13,6 +13,7 @@ pub struct Engine<'a, R, W> { pub author: &'a str, pub reader: R, pub writer: W, + pub engine_options: Vec, } /// Notes to delete later: @@ -38,17 +39,14 @@ where R: BufRead, W: Write, { - pub fn new(name: &'a str, author: &'a str, reader: R, writer: W) -> Engine<'a, R, W> { - - // TODO: This should also take an EngineOptions thing that indicates which options are supported - // so that when called it can send them easily. - // Engine options are all optional and appeared to be fixed by the UCI standard. - + pub fn new(name: &'a str, author: &'a str, + reader: R, writer: W, engine_options: Vec) -> Engine<'a, R, W> { Engine { name: name, author: author, reader: reader, writer: writer, + engine_options: engine_options, } } diff --git a/src/options.rs b/src/options.rs index 09de1a3..c6e1e55 100644 --- a/src/options.rs +++ b/src/options.rs @@ -3,6 +3,42 @@ //! and EngineOption tries to be flexible so it can be reused for each option, which also maintaining some //! of the nicer parts of typechecking. +/// Represents the hash option +pub const HASH: &'static str = "Hash"; + +/// Represents the Nalimov Path option +pub const NALIMOVPATH: &'static str = "NalimovPath"; + +/// Represents the Nalimov Cache option +pub const NALIMOVCACHE: &'static str = "NalimovCache"; + +/// Represents the ponder option +pub const PONDER: &'static str = "Ponder"; + +/// Represents the OwnBook option +pub const OWNBOOK: &'static str = "OwnBook"; + +/// Represents the MultiPV option +pub const MULTIPV: &'static str = "MultiPV"; + +/// Represents the UCI_ShowCurrLine option +pub const UCISHOWCURRLINE: &'static str = "UCI_ShowCurrLine"; + +/// Represents the UCI_Refutations option +pub const UCISHOWREFUTATIONS: &'static str = "UCI_ShowRefutations"; + +/// Represents the UCI_LimitStrength option +pub const UCISHOWREFUTATIONS: &'static str = "UCI_LimitStrength"; + +/// Represents the UCI_Elo option +pub const UCIELO: &'static str = "UCI_Elo"; + +/// Represents the UCI_AnalysisMode option +pub const UCIANALYSISMODE: &'static str = "UCI_AnalysisMode"; + +/// Represents the UCI_Opponent option +pub const UCIOPPONENT: &'static str = "UCI_Opponent"; + #[derive(Debug)] /// The `EngineOptionType` type used to indicate what type of option the GUI should display enum EngineOptionType { @@ -32,7 +68,7 @@ struct EngineOptionDataValue { #[derive(Debug, PartialEq)] /// The `EngineOption` type is the overarching type representing a single configurable engine option struct EngineOption { - name: String, + name: &'static str, option_type: EngineOptionType, option_data: HashMap>, }