summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJustin Worthe <justin@worthe-it.co.za>2018-08-12 21:26:41 +0200
committerJustin Worthe <justin@worthe-it.co.za>2018-08-12 21:26:41 +0200
commit268d82833ec4ab18baa6f2f79ffd417c1f1c8a9a (patch)
treee8e5c7a490b8cbe4af59878034a5b6fcfa3b2d86 /src
parentf5de63875890cfca2891848f54e8cd35019bea8e (diff)
Fixed logic error on when nothing should be avoided
Diffstat (limited to 'src')
-rw-r--r--src/strategy/monte_carlo.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/strategy/monte_carlo.rs b/src/strategy/monte_carlo.rs
index 4d699c1..78ec4ac 100644
--- a/src/strategy/monte_carlo.rs
+++ b/src/strategy/monte_carlo.rs
@@ -116,9 +116,10 @@ fn simulate_to_endstate<R: Rng>(command_score: &mut CommandScore, state: &Bitwis
fn random_move<R: Rng>(player: &Player, rng: &mut R) -> Command {
let all_buildings = sensible_buildings(player);
- let nothing_count = if all_buildings.len() > 2 { 1 } else { 0 };
- let iron_curtain_count = if player.can_build_iron_curtain() { 1 } else { 0 };
let free_positions_count = player.unoccupied_cell_count();
+
+ let nothing_count = if all_buildings.len() > 2 && free_positions_count > 0 { 0 } else { 1 };
+ let iron_curtain_count = if player.can_build_iron_curtain() { 1 } else { 0 };
let building_choice_index = rng.gen_range(0, all_buildings.len() + nothing_count + iron_curtain_count);