diff options
author | Justin Worthe <justin@worthe-it.co.za> | 2018-09-08 10:36:09 +0200 |
---|---|---|
committer | Justin Worthe <justin@worthe-it.co.za> | 2018-09-08 10:36:09 +0200 |
commit | 32e1dedc420c1011f63aaa90ed96fa19d2590a77 (patch) | |
tree | e275b238fc529bf8a9ea6be3036495322a3d4cf2 /src/strategy | |
parent | 0da5a09df776ba7f08550641d990707392c24e4c (diff) |
Feature-flaggified weighting win ratios
Diffstat (limited to 'src/strategy')
-rw-r--r-- | src/strategy/monte_carlo.rs | 6 |
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) |