summaryrefslogtreecommitdiff
path: root/src/strategy/monte_carlo.rs
diff options
context:
space:
mode:
authorJustin Worthe <justin@worthe-it.co.za>2018-09-06 21:20:04 +0200
committerJustin Worthe <justin@worthe-it.co.za>2018-09-06 21:20:04 +0200
commit4ad0035f4f11b41e400a1f567fdcd3541fa3f21e (patch)
tree95e8ad882f6b6c8be9c6d7a4bed2eaa7b5d2caa2 /src/strategy/monte_carlo.rs
parent6c8d7fc3a3a00fcee50592ef618d2b88fed0dbfe (diff)
Filled in the remaining TODOs on the tree search
Diffstat (limited to 'src/strategy/monte_carlo.rs')
-rw-r--r--src/strategy/monte_carlo.rs7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/strategy/monte_carlo.rs b/src/strategy/monte_carlo.rs
index dba735c..56701f5 100644
--- a/src/strategy/monte_carlo.rs
+++ b/src/strategy/monte_carlo.rs
@@ -10,9 +10,6 @@ use rand::{Rng, XorShiftRng, SeedableRng};
use arrayvec::ArrayVec;
-const MAX_MOVES: u16 = 400;
-const INIT_SEED: [u8;16] = [0x7b, 0x6a, 0xe1, 0xf4, 0x41, 0x3c, 0xe9, 0x0f, 0x67, 0x81, 0x67, 0x99, 0x77, 0x0a, 0x6b, 0xda];
-
use time::{Duration, PreciseTime};
#[cfg(not(feature = "single-threaded"))]
@@ -168,7 +165,7 @@ fn simulate_to_endstate<R: Rng>(command_score: &mut CommandScore, state: &Bitwis
}
#[cfg(feature = "heuristic-random")]
-fn random_move<R: Rng>(player: &Player, opponent: &Player, rng: &mut R) -> Command {
+pub fn random_move<R: Rng>(player: &Player, opponent: &Player, rng: &mut R) -> Command {
lazy_static! {
static ref MOVES: [Command; NUMBER_OF_POSSIBLE_MOVES] = {
let mut m = [Command::Nothing; NUMBER_OF_POSSIBLE_MOVES];
@@ -318,7 +315,7 @@ fn random_move<R: Rng>(player: &Player, opponent: &Player, rng: &mut R) -> Comma
}
#[cfg(not(feature = "heuristic-random"))]
-fn random_move<R: Rng>(player: &Player, _opponent: &Player, rng: &mut R) -> Command {
+pub fn random_move<R: Rng>(player: &Player, _opponent: &Player, rng: &mut R) -> Command {
let free_positions_count = player.unoccupied_cell_count();
let open_building_spot = free_positions_count > 0;