pub struct Engine { /* private fields */ }
Implementations§
source§impl Engine
impl Engine
sourcepub fn movetime(self, new_movetime: u32) -> Engine
pub fn movetime(self, new_movetime: u32) -> Engine
Changes the amount of time the engine spends looking for a move
§Arguments
new_movetime
- New timelimit in milliseconds
sourcepub fn make_moves(&self, moves: &[String]) -> Result<()>
pub fn make_moves(&self, moves: &[String]) -> Result<()>
Asks the engine to play the given moves from the initial position on it’s internal board.
§Arguments
moves
- A list of moves for the engine to play. Uses Coordinate notation
§Errors
Returns EngineError
if there’s an error while communicating with the engine.
§Examples
let engine = uci::Engine::new("stockfish").unwrap();
let moves = vec!["e2e4".to_string(), "e7e5".to_string()];
engine.make_moves(&moves).unwrap();
sourcepub fn set_position(&self, fen: &str) -> Result<()>
pub fn set_position(&self, fen: &str) -> Result<()>
sourcepub fn make_moves_from_position(
&self,
fen: &str,
moves: &[String]
) -> Result<()>
pub fn make_moves_from_position( &self, fen: &str, moves: &[String] ) -> Result<()>
Asks the engine to use the position represented by the given FEN string and then play the given moves from that position
§Errors
Returns an EngineError
if there’s an error while communicating with the engine.
sourcepub fn bestmove(&self) -> Result<String>
pub fn bestmove(&self) -> Result<String>
Returns the best move in the current position according to the engine
§Errors
Returns an error if the engine is not ready to return a move
sourcepub fn set_option(&self, name: &str, value: &str) -> Result<()>
pub fn set_option(&self, name: &str, value: &str) -> Result<()>
Sets an engine specific option to the given value
§Arguments
name
- Name of the optionvalue
- New value for the option
§Errors
Returns an EngineError
if the engine doesn’t support the option
§Examples
let engine = uci::Engine::new("stockfish").unwrap();
engine.set_option("Skill Level", "5").unwrap();
Auto Trait Implementations§
impl !Freeze for Engine
impl !RefUnwindSafe for Engine
impl Send for Engine
impl !Sync for Engine
impl Unpin for Engine
impl UnwindSafe for Engine
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more