diff options
author | Justin Worthe <justin@worthe-it.co.za> | 2019-05-26 00:28:28 +0200 |
---|---|---|
committer | Justin Worthe <justin@worthe-it.co.za> | 2019-05-26 00:28:28 +0200 |
commit | d37be51f196eebdb8df57c87e8ab5bb684e1dcd9 (patch) | |
tree | 9625bf847698fd4072682839ede1f917c74bebbd /src/game | |
parent | 7b3fe83b4bdb943d3d44ed036150d017279cfe05 (diff) |
Score based MCTS
Diffstat (limited to 'src/game')
-rw-r--r-- | src/game/player.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/game/player.rs b/src/game/player.rs index 917abef..1704a27 100644 --- a/src/game/player.rs +++ b/src/game/player.rs @@ -30,12 +30,12 @@ impl Player { .find(|w| w.id == id) } - pub fn active_worm(&self) -> &Worm { - &self.worms[self.active_worm] + pub fn active_worm(&self) -> Option<&Worm> { + self.worms.get(self.active_worm) } - pub fn active_worm_mut(&mut self) -> &mut Worm { - &mut self.worms[self.active_worm] + pub fn active_worm_mut(&mut self) -> Option<&mut Worm> { + self.worms.get_mut(self.active_worm) } pub fn health(&self) -> i32 { |