We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ae422e0 commit 139f39dCopy full SHA for 139f39d
src/solver/state.rs
@@ -253,10 +253,14 @@ impl State {
253
254
/// Calculates and returns the lower bound value for the current state.
255
fn calculate_lower_bound(&self, solver: &Solver) -> usize {
256
- self.crate_positions
257
- .iter()
258
- .map(|crate_position| solver.lower_bounds()[&crate_position])
259
- .sum()
+ let mut sum: usize = 0;
+ for crate_position in &self.crate_positions {
+ match solver.lower_bounds().get(&crate_position) {
+ Some(lower_bound) => sum += lower_bound,
260
+ None => return 10_000 - 1,
261
+ }
262
263
+ sum
264
}
265
266
/// Checks if a position can block the player's movement.
0 commit comments