mirror of
https://github.com/bertptrs/adventofcode.git
synced 2025-12-25 21:00:31 +01:00
Disturbingly simple optimization
This commit is contained in:
@@ -35,7 +35,7 @@ fn collides(shape: &[&[bool]], cavern: &IndexSet, x: usize, y: usize) -> bool {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (col, &on) in line.iter().enumerate() {
|
for (col, &on) in line.iter().enumerate().rev() {
|
||||||
if on && cavern.contains((y - row) * WIDTH + x + col) {
|
if on && cavern.contains((y - row) * WIDTH + x + col) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user