Changed default implementation used by main to be bitwise
[entelect-challenge-tower-defence.git] / src / bin / perf-test.rs
1 extern crate zombot;
2 extern crate time;
3 use time::{PreciseTime, Duration};
4
5 use zombot::*;
6
7 const STATE_PATH: &str = "tests/state0.json";
8
9 use std::process;
10
11 fn main() {
12     expressive();
13     bitwise();
14 }
15
16 fn expressive() {
17     println!("Running expressive engine");
18     let start_time = PreciseTime::now();
19     let (settings, state) = match input::json::read_expressive_state_from_file(STATE_PATH) {
20         Ok(ok) => ok,
21         Err(error) => {
22             println!("Error while parsing JSON file: {}", error);
23             process::exit(1);
24         }
25     };
26     let max_time = Duration::milliseconds(1950);
27     strategy::monte_carlo::choose_move(&settings, &state, &start_time, max_time);
28 }
29
30 fn bitwise() {
31     println!("Running bitwise engine");
32     let start_time = PreciseTime::now();
33     let (settings, state) = match input::json::read_bitwise_state_from_file(STATE_PATH) {
34         Ok(ok) => ok,
35         Err(error) => {
36             println!("Error while parsing JSON file: {}", error);
37             process::exit(1);
38         }
39     };
40     let max_time = Duration::milliseconds(1950);
41     strategy::monte_carlo::choose_move(&settings, &state, &start_time, max_time);
42 }