diff options
author | Justin Worthe <justin@worthe-it.co.za> | 2018-09-02 20:48:15 +0200 |
---|---|---|
committer | Justin Worthe <justin@worthe-it.co.za> | 2018-09-02 20:48:15 +0200 |
commit | b78eae28a11edefb27599d16307f248b52f74b6d (patch) | |
tree | 22a6c9b7ccfa55c572d211d8f88c3f81db3dc33e /src/engine | |
parent | 4c8b8667cbd0d16f6da056c1404a841196654e9b (diff) |
Made it possible to build iron curtains as they become available
Diffstat (limited to 'src/engine')
-rw-r--r-- | src/engine/bitwise_engine.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/engine/bitwise_engine.rs b/src/engine/bitwise_engine.rs index afd4bcc..35b574e 100644 --- a/src/engine/bitwise_engine.rs +++ b/src/engine/bitwise_engine.rs @@ -336,6 +336,11 @@ impl Player { self.iron_curtain_available && self.iron_curtain_remaining == 0 } + pub fn can_build_iron_curtain_in(&self, round: u16, moves: u8) -> bool { + let unlocks = round % IRON_CURTAIN_UNLOCK_INTERVAL > round + u16::from(moves) % IRON_CURTAIN_UNLOCK_INTERVAL; + (self.iron_curtain_available || unlocks) && self.iron_curtain_remaining.saturating_sub(moves) == 0 + } + pub fn unoccupied_cell_count(&self) -> usize { self.occupied.count_zeros() as usize } pub fn location_of_unoccupied_cell(&self, i: usize) -> Point { let bit = find_bit_index_from_rank(self.occupied, i as u64); |