Put selection of full monte carlo tree behind a feature flag
authorJustin Worthe <justin@worthe-it.co.za>
Sat, 8 Sep 2018 06:47:24 +0000 (08:47 +0200)
committerJustin Worthe <justin@worthe-it.co.za>
Sat, 8 Sep 2018 06:47:24 +0000 (08:47 +0200)
Cargo.toml
src/bin/perf-test.rs
src/main.rs

index c596887..9ec8947 100644 (file)
@@ -28,6 +28,7 @@ extended-time = []
 energy-cutoff = []
 discard-poor-performers = []
 heuristic-random = ["lazy_static"]
+full-monte-carlo-tree = []
 
 default = ["energy-cutoff", "discard-poor-performers", "heuristic-random"]
 
index da7a0a5..ee0c2be 100644 (file)
@@ -10,10 +10,6 @@ const STATE_PATH: &str = "tests/state0.json";
 use std::process;
 
 fn main() {
-    bitwise();
-}
-
-fn bitwise() {
     println!("Running bitwise engine");
     let start_time = PreciseTime::now();
     let state = match input::json::read_bitwise_state_from_file(STATE_PATH) {
@@ -24,5 +20,7 @@ fn bitwise() {
         }
     };
     let max_time = Duration::milliseconds(MAX_TIME_MILLIS);
-    strategy::monte_carlo::choose_move(&state, start_time, max_time);
+
+    #[cfg(feature = "full-monte-carlo-tree")] strategy::monte_carlo_tree::choose_move(&state, start_time, max_time);
+    #[cfg(not(feature = "full-monte-carlo-tree"))] strategy::monte_carlo::choose_move(&state, start_time, max_time);
 }
index 26d6eac..05b9546 100644 (file)
@@ -35,7 +35,8 @@ fn main() {
     };
 
     // TODO: Opening playbook?
-    let command = strategy::monte_carlo::choose_move(&state, start_time, max_time);
+    #[cfg(feature = "full-monte-carlo-tree")] let command = strategy::monte_carlo_tree::choose_move(&state, start_time, max_time);
+    #[cfg(not(feature = "full-monte-carlo-tree"))] let command = strategy::monte_carlo::choose_move(&state, start_time, max_time);
 
     match write_command(COMMAND_PATH, command) {
         Ok(()) => {}