refactor: day 8
This commit is contained in:
parent
bb4e9bbbdd
commit
35c7749abf
@ -16,13 +16,12 @@ fn _parse (data: &str) -> I {
|
||||
let l = l.trim();
|
||||
w = l.len();
|
||||
for (i, c) in l.chars().enumerate() {
|
||||
if c == '.' { continue; }
|
||||
m.entry(c).or_default().push((h as isize, i as isize));
|
||||
}
|
||||
h += 1;
|
||||
}
|
||||
|
||||
m.remove(&'.');
|
||||
|
||||
(m, w as isize, h as isize)
|
||||
}
|
||||
|
||||
@ -48,7 +47,6 @@ fn _solve ((map, width, height): I, n: isize) -> O {
|
||||
let new = [(b.0 + ydiff_mul, b.1 + xdiff_mul), (a.0 - ydiff_mul, a.1 - xdiff_mul)];
|
||||
|
||||
s.extend(new.into_iter().filter(is_valid));
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user