summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorJustin Worthe <justin@worthe-it.co.za>2019-08-10 13:41:02 +0200
committerJustin Worthe <justin@worthe-it.co.za>2019-08-10 13:41:02 +0200
commit903a5a1e9a3f5a7029f8fc30b05fff5c9a77eee3 (patch)
tree9bc01531f04f7a048ea429f759c86649b48b042c /src/main.rs
parent355bd2f20d4a9cb60cf9c3898fe54a22445266e6 (diff)
Simplified code that doesn't have a strategy cache anymore
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs10
1 files changed, 2 insertions, 8 deletions
diff --git a/src/main.rs b/src/main.rs
index 280df8a..6f3fba5 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -12,7 +12,6 @@ use steam_powered_wyrm::strategy::choose_move;
fn main() {
let max_time = Duration::milliseconds(900);
let mut game_board = None;
- let mut strategy_cache = None;
for line in stdin().lock().lines() {
let start_time = PreciseTime::now();
@@ -25,18 +24,13 @@ fn main() {
Ok(json_state) => match &mut game_board {
None => {
let new_board = game::GameBoard::new(json_state);
- let (command, cache) =
- choose_move(&new_board, strategy_cache, start_time, max_time);
- strategy_cache = Some(cache);
+ let command = choose_move(&new_board, start_time, max_time);
game_board = Some(new_board);
command
}
Some(game_board) => {
game_board.update(json_state);
- let (command, cache) =
- choose_move(&game_board, strategy_cache, start_time, max_time);
- strategy_cache = Some(cache);
- command
+ choose_move(&game_board, start_time, max_time)
}
},
Err(e) => {