summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authorJustin Worthe <justin@worthe-it.co.za>2019-05-14 00:45:49 +0200
committerJustin Worthe <justin@worthe-it.co.za>2019-05-14 00:45:49 +0200
commitdcbd04dfdc6dd6dac88020d3a51f23fa5905c356 (patch)
treedc02ab4951f01f6c1561928390e848f8f415ecac /src/bin
parent652242e584ee2b7cfb3021d570a63e57cfa52773 (diff)
Filled in the rest of the MCTS
Problem: The current random things isn't actually finding any victorious end states. This game easily meanders if it's played without purpose.
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/benchmark.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/bin/benchmark.rs b/src/bin/benchmark.rs
new file mode 100644
index 0000000..794ba4e
--- /dev/null
+++ b/src/bin/benchmark.rs
@@ -0,0 +1,22 @@
+use std::path::Path;
+
+use time::{Duration, PreciseTime};
+
+use steam_powered_wyrm::strategy::choose_move;
+use steam_powered_wyrm::json;
+use steam_powered_wyrm::game;
+
+fn main() {
+ let max_time = Duration::milliseconds(950);
+ let start_time = PreciseTime::now();
+
+ match json::read_state_from_json_file(&Path::new(&format!("./tests/example-state.json"))) {
+ Ok(json_state) => {
+ let new_board = game::GameBoard::new(json_state);
+ let _ = choose_move(&new_board, &start_time, max_time);
+ },
+ Err(e) => {
+ eprintln!("WARN: State file could not be parsed: {}", e);
+ }
+ };
+}