From a866bde485c7d8bc82820f2def70af7b6c70a066 Mon Sep 17 00:00:00 2001 From: Justin Wernick Date: Tue, 19 Apr 2022 21:25:36 +0200 Subject: Refile for merging repos --- 2017-battleships/src/main.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 2017-battleships/src/main.rs (limited to '2017-battleships/src/main.rs') diff --git a/2017-battleships/src/main.rs b/2017-battleships/src/main.rs new file mode 100644 index 0000000..ee0ba59 --- /dev/null +++ b/2017-battleships/src/main.rs @@ -0,0 +1,19 @@ +extern crate worthebot_battleships; + +use worthebot_battleships as bot; +use std::env; +use std::path::PathBuf; + +fn main() { + let working_dir = env::args() + .nth(2) + .map(|x| PathBuf::from(x)) + .ok_or(String::from("Requires game state folder to be passed as the second parameter")); + + let result = working_dir.and_then(|working_dir| bot::write_move(working_dir)); + + match result { + Ok(()) => println!("Bot terminated successfully"), + Err(e) => println!("Error in bot execution: {}", e) + } +} -- cgit v1.2.3