diff --git a/card_game/src/lib.rs b/card_game/src/lib.rs index 40193da..6d6727a 100644 --- a/card_game/src/lib.rs +++ b/card_game/src/lib.rs @@ -410,7 +410,8 @@ where let mut state_moves = std::collections::HashMap::with_capacity(HUGE_CAP); let mut state = self.clone(); while !state.is_win() { - if HUGE_CAP <= state_moves.len() { + // don't look for empty hash map buckets when the hash map is 99% full! + if HUGE_CAP * 127 <= state_moves.len() * 128 { return Err(Oom); }