diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..f686ead --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,8 @@ +# Contributing to UCI + +TODO + + +# Styleguide + +We try to make use of the styleguide found [here](https://github.com/rust-lang-nursery/fmt-rfcs/blob/master/guide/guide.md). diff --git a/src/commands.rs b/src/commands.rs index 0728577..ac8cc1f 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -75,10 +75,10 @@ pub const REGISTRATIONCHECKING: &'static str = "registration checking\n"; pub const REGISTRATIONOK: &'static str = "registration ok\n"; /// REGISTRATIONERROR tells the GUI that the engine has rejected the registration -pub const COPYPROTECTIONCHECKING: &'static str = "registration error\n"; +pub const REGISTRATIONERROR: &'static str = "registration error\n"; /// INFO tells the GUI the engine wants to sent infos to the GUI. This should be done whenever the info has changed -pub const INFO &'static str = "info"; +pub const INFO: &'static str = "info"; /// OPTION tells the GUI which parameters can be changed in the engine -pub const OPTION &'static str = "option"; +pub const OPTION: &'static str = "option"; diff --git a/src/lib.rs b/src/lib.rs index cb71d6d..df935d1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -3,4 +3,24 @@ mod commands; +pub struct Engine<'a> { + pub name: &'a str, + pub author: &'a str, +} +/// Notes to delete later: +/// +/// The user will have to provide code to run for the lifecycle. Moreover the user will have to overwrite a handful +/// of methods that need explicit contact with the underlying engine code to determine what to do before doing a +/// "run". There needs to be a "loop" that kicks off a thread to monitor stdin and also calculations, etc. +/// It will be worth taking the time to map out exactly how a user will be able to use this generic UCI interface +/// effectively without losing too much and/or making their lives hard. + +impl<'a> Engine<'a> { + pub fn new(name: &'a str, author: &'a str) -> Engine<'a> { + Engine { + name: name, + author: author, + } + } +} diff --git a/tests/lib.rs b/tests/lib.rs new file mode 100644 index 0000000..77c9bb2 --- /dev/null +++ b/tests/lib.rs @@ -0,0 +1,11 @@ +extern crate uci; + +use uci::Engine; + +#[test] +fn instantiate_new_engine() { + let e: Engine; + e = Engine::new("test_name", "test"); + assert_eq!(e.name, "test_name"); + assert_eq!(e.author, "test"); +}