summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Worthe <justin@worthe-it.co.za>2018-08-09 13:07:15 +0200
committerJustin Worthe <justin@worthe-it.co.za>2018-08-09 13:07:15 +0200
commit72a86bb4c043b6316e5c5f163cdd1e66cb99229f (patch)
treea4abbfafe6e65b50db398a9b23cc435a28fa0a69
parentf6e6e99cb233549cd913e87efb1062c3b50dbbaf (diff)
Added more TODO ideas
-rw-r--r--src/engine/bitwise_engine.rs1
-rw-r--r--src/engine/geometry.rs3
-rw-r--r--src/strategy/monte_carlo.rs7
3 files changed, 10 insertions, 1 deletions
diff --git a/src/engine/bitwise_engine.rs b/src/engine/bitwise_engine.rs
index db31511..8a4ea91 100644
--- a/src/engine/bitwise_engine.rs
+++ b/src/engine/bitwise_engine.rs
@@ -16,6 +16,7 @@ pub struct BitwiseGameState {
pub opponent_buildings: PlayerBuildings,
}
+//TODO: Add in smallvec?
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct PlayerBuildings {
pub unconstructed: Vec<UnconstructedBuilding>,
diff --git a/src/engine/geometry.rs b/src/engine/geometry.rs
index 28df774..de9d95a 100644
--- a/src/engine/geometry.rs
+++ b/src/engine/geometry.rs
@@ -1,5 +1,8 @@
use engine::constants::*;
+//TODO: Change Point to be a single number, or stored as a bitfield
+// (bitfield to x and y for writing move might be hard?
+
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct Point {
pub x: u8,
diff --git a/src/strategy/monte_carlo.rs b/src/strategy/monte_carlo.rs
index 127e690..d4003bb 100644
--- a/src/strategy/monte_carlo.rs
+++ b/src/strategy/monte_carlo.rs
@@ -123,6 +123,7 @@ fn random_opponent_move<R: Rng, GS: GameState>(settings: &GameSettings, state: &
random_move(&all_buildings, rng, state.unoccupied_opponent_cell_count(), |i| state.location_of_unoccupied_opponent_cell(i))
}
+// TODO: Given enough energy, most opponents won't do nothing
fn random_move<R: Rng, F:Fn(usize)->Point>(all_buildings: &[BuildingType], rng: &mut R, free_positions_count: usize, get_point: F) -> Command {
let building_command_count = free_positions_count*all_buildings.len();
let nothing_count = 1;
@@ -131,6 +132,8 @@ fn random_move<R: Rng, F:Fn(usize)->Point>(all_buildings: &[BuildingType], rng:
let choice_index = rng.gen_range(0, number_of_commands);
+ // TODO: Remove the divide here?
+
if choice_index == number_of_commands - 1 {
Command::Nothing
} else {
@@ -192,7 +195,8 @@ impl CommandScore {
fn win_ratio(&self) -> i32 {
(self.victories as i32 - self.defeats as i32) * 10000 / (self.attempts as i32)
}
-
+
+ //TODO: Devalue nothing so that it doesn't stand and do nothing when it can do things
fn init_command_scores<GS: GameState>(settings: &GameSettings, state: &GS) -> Vec<CommandScore> {
let all_buildings = sensible_buildings(settings, &state.player(), state.player_has_max_teslas());
@@ -229,6 +233,7 @@ fn sensible_buildings(settings: &GameSettings, player: &Player, has_max_teslas:
}
+//TODO: Heuristic that avoids building the initial energy towers all in the same row?
#[cfg(feature = "energy-cutoff")]
fn sensible_buildings(settings: &GameSettings, player: &Player, has_max_teslas: bool) -> Vec<BuildingType> {
let mut result = Vec::with_capacity(4);