diff options
author | Justin Worthe <justin@worthe-it.co.za> | 2018-08-14 22:40:57 +0200 |
---|---|---|
committer | Justin Worthe <justin@worthe-it.co.za> | 2018-08-14 22:40:57 +0200 |
commit | 89f2c5b50576afcf25fc8eb53a053ce75a6cf042 (patch) | |
tree | 7afa8452822e1e6e39624e5e127ba05a59b8bd20 | |
parent | 268d82833ec4ab18baa6f2f79ffd417c1f1c8a9a (diff) |
Bumped dependency version numbers
-rw-r--r-- | Cargo.toml | 12 | ||||
-rw-r--r-- | src/strategy/monte_carlo.rs | 15 |
2 files changed, 14 insertions, 13 deletions
@@ -3,18 +3,18 @@ name = "zombot" version = "2.0.0" [dependencies] -serde_derive = "1.0.43" -serde = "1.0.43" -serde_json = "1.0.16" +serde_derive = "1.0.71" +serde = "1.0.71" +serde_json = "1.0.26" -rand = "0.4.2" +rand = "0.5.5" time = "0.1.4" -rayon = "1.0.1" +rayon = "1.0.2" arrayvec = "0.4.7" [dev-dependencies] -proptest = "0.7.2" +proptest = "0.8.4" [features] benchmarking = [] diff --git a/src/strategy/monte_carlo.rs b/src/strategy/monte_carlo.rs index 78ec4ac..2b98eed 100644 --- a/src/strategy/monte_carlo.rs +++ b/src/strategy/monte_carlo.rs @@ -105,7 +105,8 @@ fn simulate_to_endstate<R: Rng>(command_score: &mut CommandScore, state: &Bitwis status = state_mut.simulate(player_command, opponent_command); } - let next_seed = [rng.next_u32(), rng.next_u32(), rng.next_u32(), rng.next_u32()]; + let mut next_seed: [u8;16] = [0; 16]; + rng.fill_bytes(&mut next_seed); match status { GameStatus::PlayerWon => command_score.add_victory(next_seed), GameStatus::OpponentWon => command_score.add_defeat(next_seed), @@ -145,7 +146,7 @@ struct CommandScore { draws: u32, stalemates: u32, attempts: u32, - next_seed: [u32; 4] + next_seed: [u8; 16] } impl CommandScore { @@ -157,29 +158,29 @@ impl CommandScore { draws: 0, stalemates: 0, attempts: 0, - next_seed: [0x7b6a_e1f4, 0x413c_e90f, 0x6781_6799, 0x770a_6bda] + next_seed: [0x7b, 0x6a, 0xe1, 0xf4, 0x41, 0x3c, 0xe9, 0x0f, 0x67, 0x81, 0x67, 0x99, 0x77, 0x0a, 0x6b, 0xda] } } - fn add_victory(&mut self, next_seed: [u32; 4]) { + fn add_victory(&mut self, next_seed: [u8; 16]) { self.victories += 1; self.attempts += 1; self.next_seed = next_seed; } - fn add_defeat(&mut self, next_seed: [u32; 4]) { + fn add_defeat(&mut self, next_seed: [u8; 16]) { self.defeats += 1; self.attempts += 1; self.next_seed = next_seed; } - fn add_draw(&mut self, next_seed: [u32; 4]) { + fn add_draw(&mut self, next_seed: [u8; 16]) { self.draws += 1; self.attempts += 1; self.next_seed = next_seed; } - fn add_stalemate(&mut self, next_seed: [u32; 4]) { + fn add_stalemate(&mut self, next_seed: [u8; 16]) { self.stalemates += 1; self.attempts += 1; self.next_seed = next_seed; |