Browse Source

enumerate basic commands

ag-yep
Taylor Bockman 7 years ago
parent
commit
1875853925
  1. 7
      .travis.yml
  2. 84
      src/commands.rs
  3. 13
      src/lib.rs

7
.travis.yml

@ -0,0 +1,7 @@
language: rust
rust:
- stable
- nightly
matrix:
allow_failures:
- rust: stable

84
src/commands.rs

@ -0,0 +1,84 @@
//! Commands contains the command constants expected during the UCI lifecycle
//! It is useful to note many of these commands do not end with '\n'. This is because they expect arguments.
///////// GUI to Engine /////////
/// Tell engine to use the UCI (Universal Chess Interface)
pub const UCI: &'static str = "uci\n";
/// DEBUG toggles the debug mode of the engine on or off
pub const DEBUG: &'static str = "debug";
pub const DEBUGON: &'static str = "on";
pub const DEBUGOFF: &'static str = "off";
/// ISREADY synchronizes the engine with the GUI
pub const ISREADY: &'static str = "isready\n";
/// SETOPTION is sent to the engine when the user wants to change an internal parameter
pub const SETOPTION: &'static str = "setoption";
/// REGISTER is the command used to try to register an engine or tell the engine that registration will be done
/// later
pub const REGISTER: &'static str = "register";
/// UCINEWGAME is sent to the engine when the next search (started with "position" and "go") will be from a different
/// game
pub const UCINEWGAME: &'static str = "ucinewgame\n";
/// POSITION is sent to set up the position described in fenstring on the internal board and play the moves on the
/// internal chess board
pub const POSITION: &'static str = "position";
/// GO signals to start calculating on the current position set up with the "position" command
pub const GO: &'static str = "go\n";
/// STOP signals to stop calculating as soon as possible
pub const STOP: &'static str = "stop\n";
/// PONDERHIT will be sent if the engine was told to ponder on the same move the user has played
pub const PONDERHIT: &'static str = "ponderhit\n";
/// QUIT signals to quit the program as soon as possible
pub const QUIT: &'static str = "quit\n";
///////// Engine to GUI /////////
/// ID is used to signal the engine name and author to the GUI
pub const ID: &'static str = "id";
/// UCIOK is sent after the ID and optional options to tell the GUI that the engine has sent all infos and is ready
/// in UCI mode
pub const UCIOK: &'static str = "uciok\n";
/// READYOK is sent when the engine has received an "isready" command and has processed all input and is ready to
/// accept new commands now
pub const READYOK: &'static str = "readyok\n";
/// BESTMOVE is sent when the engine has stopped searching and found the move best in this position
pub const BESTMOVE: &'static str = "bestmove";
/// COPYPROTECTIONCHECKING tells the GUI that the engine is checking the copy protection
pub const COPYPROTECTIONCHECKING: &'static str = "copyprotection checking\n";
/// COPYPROTECTIONOK tells the GUI that the engine has verified the copy protection
pub const COPYPROTECTIONOK: &'static str = "copyprotection ok\n";
/// COPYPROTECTIONERROR tells the GUI that the engine has rejected the copy protection
pub const COPYPROTECTIONERROR: &'static str = "copyprotection error\n";
/// REGISTRATIONCHECKING tells the GUI that the engine is checking the registration
pub const REGISTRATIONCHECKING: &'static str = "registration checking\n";
/// REGISTRATIONOK tells the GUI that the engine the registration has been verified
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";
/// 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";
/// OPTION tells the GUI which parameters can be changed in the engine
pub const OPTION &'static str = "option";

13
src/lib.rs

@ -1,7 +1,6 @@
#[cfg(test)] //! UCI is a simple library to allow people to ignore the lower-level protocol needed to create chess engines.
mod tests {
#[test] mod commands;
fn it_works() {
assert_eq!(2 + 2, 4);
}
}

Loading…
Cancel
Save