An implementation of the Universal Chess Interface in Rust.
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
//! 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!");
|
|
|
|
}
|
|
|
|
}
|