summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Worthe <justin@worthe-it.co.za>2018-09-08 08:47:24 +0200
committerJustin Worthe <justin@worthe-it.co.za>2018-09-08 08:47:24 +0200
commit188c3c1ef073187cfb957dd5afe1aa0e7c2b6a33 (patch)
tree8ff2515b468832cee7cddabbf50b024d58a991a2
parent90a7c7d34def7e5f92f2cd521fdc014e0cbd9906 (diff)
Put selection of full monte carlo tree behind a feature flag
-rw-r--r--Cargo.toml1
-rw-r--r--src/bin/perf-test.rs8
-rw-r--r--src/main.rs3
3 files changed, 6 insertions, 6 deletions
diff --git a/Cargo.toml b/Cargo.toml
index c596887..9ec8947 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -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"]
diff --git a/src/bin/perf-test.rs b/src/bin/perf-test.rs
index da7a0a5..ee0c2be 100644
--- a/src/bin/perf-test.rs
+++ b/src/bin/perf-test.rs
@@ -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);
}
diff --git a/src/main.rs b/src/main.rs
index 26d6eac..05b9546 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -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(()) => {}