summaryrefslogtreecommitdiff
path: root/cli/src/main.rs
diff options
context:
space:
mode:
authorBotahamec <botahamec@outlook.com>2021-07-08 20:32:44 -0400
committerBotahamec <botahamec@outlook.com>2021-07-08 20:32:44 -0400
commit7e73782a7d51b40a558b74793c1d6c1abdea857d (patch)
treefba843de026f20cbcca0272c4ef521a6d4ac7ef9 /cli/src/main.rs
here's what i have so far
Diffstat (limited to 'cli/src/main.rs')
-rw-r--r--cli/src/main.rs37
1 files changed, 37 insertions, 0 deletions
diff --git a/cli/src/main.rs b/cli/src/main.rs
new file mode 100644
index 0000000..f7fcddf
--- /dev/null
+++ b/cli/src/main.rs
@@ -0,0 +1,37 @@
+use ai::CheckersBitBoard;
+use clap::{App, Arg, SubCommand};
+
+mod perft;
+
+fn main() {
+ let matches = App::new("Ampere")
+ .version("0.1")
+ .author("Botahamec <botahamec@outlook.com>")
+ .about("An American Checkers AI")
+ .subcommand(
+ SubCommand::with_name("perft")
+ .about("Calculate the number of possible moves")
+ .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") {
+ println!(
+ "{}",
+ perft::positions(
+ CheckersBitBoard::starting_position(),
+ matches
+ .value_of("depth")
+ .unwrap()
+ .parse::<usize>()
+ .expect("Error: not a valid number")
+ )
+ );
+ }
+}