Browse Source

Constants for options.rs

ag-yep
Taylor Bockman 7 years ago
parent
commit
039d1601ce
  1. 12
      src/lib.rs
  2. 38
      src/options.rs

12
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<EngineOption>,
}
/// 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<EngineOption>) -> Engine<'a, R, W> {
Engine {
name: name,
author: author,
reader: reader,
writer: writer,
engine_options: engine_options,
}
}

38
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<T> {
#[derive(Debug, PartialEq)]
/// The `EngineOption` type is the overarching type representing a single configurable engine option
struct EngineOption<T> {
name: String,
name: &'static str,
option_type: EngineOptionType,
option_data: HashMap<EngineOptionDataType, EngineOptionDataValue<T>>,
}

Loading…
Cancel
Save