Taylor Bockman
7 years ago
3 changed files with 61 additions and 8 deletions
@ -1 +1,44 @@
|
||||
//! Options contains constant strings representing the options that are possible in an UCI engin.
|
||||
//! Options contains everything related to engine options. The idea behind this is to take as much
|
||||
//! advantage of the typechecker as possible. As a result, engine option names are constant static strings,
|
||||
//! and EngineOption tries to be flexible so it can be reused for each option, which also maintaining some
|
||||
//! of the nicer parts of typechecking.
|
||||
|
||||
#[derive(Debug)] |
||||
enum EngineOptionType { |
||||
Check, |
||||
Spin, |
||||
Combo, |
||||
Button, |
||||
TypeString, // `String` is a reserved word so `TypeString` is substituted
|
||||
} |
||||
|
||||
#[derive(Debug)] |
||||
enum EngineOptionDataType { |
||||
DefaultVal, // `Default` is reserved so `DefaultVal` is used
|
||||
Min, |
||||
Max, |
||||
Var, |
||||
} |
||||
|
||||
#[derive(Debug, PartialEq)] |
||||
struct EngineOption<T> { |
||||
name: String, |
||||
option_type: EngineOptionType, |
||||
option_data: HashMap<EngineOptionDataType, EngineOptionDataValue<T>>, |
||||
} |
||||
|
||||
impl PartialEq for EngineOption { |
||||
pub fn eq(&self, other: EngineOption) { |
||||
// TODO: Implement equality on the EngineOption struct and write tests for it.
|
||||
} |
||||
} |
||||
|
||||
impl EngineOption { |
||||
pub fn option_string(&self) -> String { |
||||
// TODO: Implement this to save this when looping through and sending options
|
||||
// TODO: This should be tested in isolation as well
|
||||
// This should handle the case where optional min max var are specified as well.
|
||||
// pattern match the engine option type and convert it to the correct string.
|
||||
format!("PUT THE FULL COMMAND STRING HERE!"); |
||||
} |
||||
} |
||||
|
Loading…
Reference in new issue