From a3ca80d20d3e2aed5d1125ffd964c821e2ac8ed5 Mon Sep 17 00:00:00 2001 From: Kerollmops Date: Thu, 18 Jun 2020 15:42:46 +0200 Subject: [PATCH] Ignore every proximities bigger or equal to 8 --- src/best_proximity.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/best_proximity.rs b/src/best_proximity.rs index 8afd36ad4..467e72a5a 100644 --- a/src/best_proximity.rs +++ b/src/best_proximity.rs @@ -65,7 +65,7 @@ impl Node { parent_position: *position, }; // We do not produce the nodes we have already seen in previous iterations loops. - if node.is_complete(positions) && acc_proximity + proximity < best_proximity { + if proximity > 7 || (node.is_complete(positions) && acc_proximity + proximity < best_proximity) { None } else { Some((node, proximity)) @@ -140,7 +140,7 @@ where F: FnMut((usize, u32), (usize, u32)) -> bool, fn next(&mut self) -> Option { let before = Instant::now(); - if self.best_proximity == self.positions.len() as u32 * MAX_DISTANCE { + if self.best_proximity == self.positions.len() as u32 * (MAX_DISTANCE - 1) { return None; }