summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs9
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
}