summaryrefslogtreecommitdiff
path: root/src/strategy
diff options
context:
space:
mode:
Diffstat (limited to 'src/strategy')
-rw-r--r--src/strategy/monte_carlo.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/strategy/monte_carlo.rs b/src/strategy/monte_carlo.rs
index 039c861..978f8f1 100644
--- a/src/strategy/monte_carlo.rs
+++ b/src/strategy/monte_carlo.rs
@@ -398,10 +398,16 @@ impl CommandScore {
self.next_seed = next_seed;
}
+ #[cfg(feature = "weighted-win-ratio")]
fn win_ratio(&self) -> i32 {
(self.victory_score - self.defeat_score) * 10000 / (self.attempts as i32)
}
+ #[cfg(not(feature = "weighted-win-ratio"))]
+ fn win_ratio(&self) -> i32 {
+ (self.victories as i32 - self.defeats as i32) * 10000 / (self.attempts as i32)
+ }
+
fn init_command_scores(state: &BitwiseGameState) -> Vec<CommandScore> {
let unoccupied_cells_count = state.player.unoccupied_cell_count();
let unoccupied_cells = (0..unoccupied_cells_count)