Ignore every proximities bigger or equal to 8

This commit is contained in:
Kerollmops 2020-06-18 15:42:46 +02:00
parent 3577de04b8
commit a3ca80d20d
No known key found for this signature in database
GPG Key ID: 92ADA4E935E71FA4

View File

@ -65,7 +65,7 @@ impl Node {
parent_position: *position, parent_position: *position,
}; };
// We do not produce the nodes we have already seen in previous iterations loops. // 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 None
} else { } else {
Some((node, proximity)) Some((node, proximity))
@ -140,7 +140,7 @@ where F: FnMut((usize, u32), (usize, u32)) -> bool,
fn next(&mut self) -> Option<Self::Item> { fn next(&mut self) -> Option<Self::Item> {
let before = Instant::now(); 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; return None;
} }