From c90898da21e92da5f6c874eea9ed3aedf5330195 Mon Sep 17 00:00:00 2001 From: Justin Worthe Date: Mon, 27 Aug 2018 21:10:37 +0200 Subject: Increased the likelihood of using an iron curtain if there's energy --- src/strategy/monte_carlo.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/strategy/monte_carlo.rs b/src/strategy/monte_carlo.rs index 75ca055..27caea8 100644 --- a/src/strategy/monte_carlo.rs +++ b/src/strategy/monte_carlo.rs @@ -169,9 +169,8 @@ fn random_move(player: &Player, rng: &mut R) -> Command { let all_buildings = sensible_buildings(player, open_building_spot, open_energy_spot); - let iron_curtain_count = if player.can_build_iron_curtain() { 1 } else { 0 }; - //TODO: This appears to make things much slower. Or maybe games last longer? - let nothing_count = 1;//if all_buildings.len() + iron_curtain_count > 0 { 0 } else { 1 }; + let iron_curtain_count = if player.can_build_iron_curtain() { 5 } else { 0 }; + let nothing_count = 1; let building_choice_index = rng.gen_range(0, all_buildings.len() + nothing_count + iron_curtain_count); @@ -193,10 +192,10 @@ fn random_move(player: &Player, rng: &mut R) -> Command { all_buildings[building_choice_index] ) } - else if iron_curtain_count > 0 && building_choice_index == all_buildings.len() { - Command::IronCurtain + else if building_choice_index == all_buildings.len() { + Command::Nothing } else { - Command::Nothing + Command::IronCurtain } } @@ -277,7 +276,7 @@ impl CommandScore { let building_command_count = unoccupied_cells.len()*all_buildings.len(); let mut commands = Vec::with_capacity(building_command_count + 2); - commands.push(CommandScore::with_seeded_stalemate(Command::Nothing)); + commands.push(CommandScore::new(Command::Nothing)); if state.player.can_build_iron_curtain() { commands.push(CommandScore::new(Command::IronCurtain)); } -- cgit v1.2.3