diff options
author | Justin Wernick <justin@worthe-it.co.za> | 2020-04-10 23:17:35 +0200 |
---|---|---|
committer | Justin Wernick <justin@worthe-it.co.za> | 2020-04-10 23:17:35 +0200 |
commit | f3f798441e56afec9e6357c96274f90bf4ea6947 (patch) | |
tree | ab65f01f4757059c2ab1d3f0c21b9c6a625f0763 /src/main.rs | |
parent | 124c89cdeadc53457b016c9f8aa1ba3c4a1aa15d (diff) |
Game state from JSON state
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/main.rs b/src/main.rs index 81bc3b4..74428c3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -7,14 +7,15 @@ mod json; mod state; use command::*; -use json::*; +use state::*; fn main() { for line in stdin().lock().lines() { let round_number = line.expect("Failed to read line from stdin: {}"); let command = - match read_state_from_json_file(&format!("./rounds/{}/state.json", round_number)) { - Ok(state) => choose_command(state), + match json::read_state_from_json_file(&format!("./rounds/{}/state.json", round_number)) + { + Ok(state) => choose_command(&state), Err(e) => { eprintln!("WARN: State file could not be parsed: {}", e); Command::Nothing @@ -24,6 +25,6 @@ fn main() { } } -fn choose_command(state: State) -> Command { +fn choose_command(state: &GameState) -> Command { Command::Accelerate } |