summaryrefslogtreecommitdiff
path: root/2017-battleships/src/main.rs
diff options
context:
space:
mode:
authorJustin Wernick <justin@worthe-it.co.za>2022-04-19 21:28:54 +0200
committerJustin Wernick <justin@worthe-it.co.za>2022-04-19 21:28:54 +0200
commit59f8b6a8ef1abfd0556cc940ccb64305fcdf2968 (patch)
treeaf1e8424d7704cf7ccab5818c6d2adb915b183f3 /2017-battleships/src/main.rs
parentdc01a3e25e6c4ef056467e36f876ebd68f3ade22 (diff)
parenta866bde485c7d8bc82820f2def70af7b6c70a066 (diff)
Merge branch 'battleships-main'
Diffstat (limited to '2017-battleships/src/main.rs')
-rw-r--r--2017-battleships/src/main.rs19
1 files changed, 19 insertions, 0 deletions
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)
+ }
+}