stockfish
A small Rust library for creating and interacting with a running Stockfish process.
Requires the stockfish engine to be installed. (stockfishchess.org) The path to the binary file is to be specified in the constructor.
let stockfish = new;
A longer example:
use Stockfish;
Some different ways of invoking calculation from stockfish:
// Have stockfish calculate for five seconds, then get its output
let engine_output = stockfish.go_for?;
// Have stockfish calculate for a variable amount of time based on
// the players' move times in the chess game
// (expressed in milliseconds)
let engine_output = stockfish.go_based_on_times;
Getting more specific information from the returned engine output:
let engine_output = stockfish.go?;
let best_move = engine_output.best_move;
println!;
let eval= engine_output.eval;
match eval.eval_type ;
Some configuration options:
stockfish.set_hash?;
stockfish.set_threads?;
// Set any UCI option for stockfish
stockfish.set_option?;
FEN-related methods (Forsyth-Edwards Notation):
let fen = "r1bqkb1r/pppp1ppp/2n2n2/4p3/4P3/2N2N2/PPPP1PPP/\
R1BQKB1R w KQkq - 0 1";
stockfish.set_fen_position?;
assert_eq!;