summaryrefslogtreecommitdiff
path: root/tests/live_comparison.rs
diff options
context:
space:
mode:
authorJustin Worthe <justin@worthe-it.co.za>2018-08-09 20:40:03 +0200
committerJustin Worthe <justin@worthe-it.co.za>2018-08-09 20:40:03 +0200
commitea78e266cff3f57c39442aefc21295a758419e69 (patch)
tree8f5f707affbd546efb43b9a638d2f9ff6bd52116 /tests/live_comparison.rs
parentf41255a8dda9e2c6a18c32564a30e63eed58f6b3 (diff)
Removed dynamic settings
It worked really well for round 2 to set constants
Diffstat (limited to 'tests/live_comparison.rs')
-rw-r--r--tests/live_comparison.rs17
1 files changed, 8 insertions, 9 deletions
diff --git a/tests/live_comparison.rs b/tests/live_comparison.rs
index 23beaec..5761454 100644
--- a/tests/live_comparison.rs
+++ b/tests/live_comparison.rs
@@ -3,8 +3,7 @@ extern crate zombot;
use zombot::input::json;
use zombot::engine::command::{Command, BuildingType};
use zombot::engine::geometry::Point;
-use zombot::engine::settings::GameSettings;
-use zombot::engine::GameState;
+use zombot::engine::constants::*;
use std::fs::File;
use std::io::prelude::*;
@@ -20,14 +19,14 @@ fn it_successfully_simulates_replay_with_teslas() {
}
fn test_from_replay(replay_folder: &str, length: usize) {
- let (settings, mut state) = json::read_bitwise_state_from_file(&format!("{}/Round 000/state.json", replay_folder)).unwrap();
+ let mut state = json::read_bitwise_state_from_file(&format!("{}/Round 000/state.json", replay_folder)).unwrap();
for i in 0..length {
let player = read_player_command(&format!("{}/Round {:03}/PlayerCommand.txt", replay_folder, i));
- let opponent = read_opponent_command(&format!("{}/Round {:03}/OpponentCommand.txt", replay_folder, i), &settings);
- let (_, mut expected_state) = json::read_bitwise_state_from_file(&format!("{}/Round {:03}/state.json", replay_folder, i+1)).unwrap();
+ let opponent = read_opponent_command(&format!("{}/Round {:03}/OpponentCommand.txt", replay_folder, i));
+ let mut expected_state = json::read_bitwise_state_from_file(&format!("{}/Round {:03}/state.json", replay_folder, i+1)).unwrap();
- state.simulate(&settings, player, opponent);
+ state.simulate(player, opponent);
state.sort();
expected_state.sort();
@@ -56,15 +55,15 @@ fn read_player_command(filename: &str) -> Command {
}
}
-fn read_opponent_command(filename: &str, settings: &GameSettings) -> Command {
+fn read_opponent_command(filename: &str) -> Command {
match read_player_command(filename) {
Command::Nothing => Command::Nothing,
Command::Build(p, b) => Command::Build(Point::new(
- settings.size.x - p.x - 1,
+ FULL_MAP_WIDTH - p.x - 1,
p.y
), b),
Command::Deconstruct(p) => Command::Deconstruct(Point::new(
- settings.size.x - p.x - 1,
+ FULL_MAP_WIDTH - p.x - 1,
p.y
)),
}