diff options
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 7 |
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 |