From 01b456b4fef8ce4a002f870e5385424614a2a5fb Mon Sep 17 00:00:00 2001 From: Mike White Date: Wed, 15 Sep 2021 20:49:13 -0400 Subject: Added best move function --- cli/src/main.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'cli/src/main.rs') diff --git a/cli/src/main.rs b/cli/src/main.rs index a550092..d230398 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -31,6 +31,17 @@ fn main() { .help("The depth to go to"), ), ) + .subcommand( + SubCommand::with_name("best") + .about("Calculate the best move") + .arg( + Arg::with_name("depth") + .required(true) + .short("d") + .takes_value(true) + .help("The depth to go to"), + ), + ) .get_matches(); if let Some(matches) = matches.subcommand_matches("perft") { @@ -59,4 +70,17 @@ fn main() { ) ); } + + if let Some(matches) = matches.subcommand_matches("best") { + println!( + "{}", + eval::best_move( + matches + .value_of("depth") + .unwrap() + .parse() + .expect("Error: not a valid number") + ) + ) + } } -- cgit v1.2.3