summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorJustin Wernick <justin@worthe-it.co.za>2020-04-25 20:27:41 +0200
committerJustin Wernick <justin@worthe-it.co.za>2020-04-25 20:27:41 +0200
commitd28628822e172cf232e5a86764110870baf6fc39 (patch)
tree24e44383978f339aab6dc9df3e3ffba4e46867d9 /src/main.rs
parent52e0c74c506e2331cab8b4b118373c63cdc59364 (diff)
Event-based heuristic at the beginning, astar at the end
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs
index a652b8e..c5f7857 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -6,11 +6,14 @@ use vroomba::*;
fn main() {
for line in stdin().lock().lines() {
- let round_number = line.expect("Failed to read line from stdin: {}");
+ let round_number = line
+ .expect("Failed to read line from stdin: {}")
+ .parse::<usize>()
+ .expect("Round number was not an unsigned integer: {}");
let command =
match json::read_state_from_json_file(&format!("./rounds/{}/state.json", round_number))
{
- Ok(state) => choose_command(&state),
+ Ok(state) => choose_command(round_number, &state),
Err(e) => {
eprintln!("WARN: State file could not be parsed: {}", e);
Command::Nothing