Disturbingly simple optimization

This commit is contained in:
2022-12-18 22:57:19 +01:00
parent 483aeb7e4d
commit a3f9edd48d

View File

@@ -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;
} }