diff options
author | Justin Worthe <justin@worthe-it.co.za> | 2018-05-12 21:48:42 +0200 |
---|---|---|
committer | Justin Worthe <justin@worthe-it.co.za> | 2018-05-12 21:48:42 +0200 |
commit | d14ec12e30852f8a93f310f5c53fce6ab6f1c6c5 (patch) | |
tree | 75703f32ab2ab5bb06fd8ef94982f3d300241e6a /src/engine | |
parent | 97880f6a368085e9a409f1fb0030791a4a65005c (diff) |
Debugged and fixed the errors that had the monte carlo not working
Monte carlo now beats sample bot, if given plenty of time. I still
need to put the max time tracking and enforcement in.
Diffstat (limited to 'src/engine')
-rw-r--r-- | src/engine/mod.rs | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/src/engine/mod.rs b/src/engine/mod.rs index a1a85ce..41acb23 100644 --- a/src/engine/mod.rs +++ b/src/engine/mod.rs @@ -168,11 +168,11 @@ impl GameState { fn update_status(state: &mut GameState) { let player_dead = state.player.health == 0; - let opponent_dead = state.player.health == 0; + let opponent_dead = state.opponent.health == 0; state.status = match (player_dead, opponent_dead) { (true, true) => GameStatus::Draw, - (true, false) => GameStatus::PlayerWon, - (false, true) => GameStatus::OpponentWon, + (false, true) => GameStatus::PlayerWon, + (true, false) => GameStatus::OpponentWon, (false, false) => GameStatus::Continue, }; } @@ -262,14 +262,4 @@ impl Building { } } -#[test] -fn how_big() { - use std::mem; - assert_eq!(4, mem::size_of::<Player>()); - assert_eq!(12, mem::size_of::<Building>()); - assert_eq!(6, mem::size_of::<Missile>()); - assert_eq!(112, mem::size_of::<GameState>()); - assert_eq!(24, mem::size_of::<Vec<Building>>()); - assert_eq!(24, mem::size_of::<Vec<Missile>>()); - -} + |