Compare commits

..

2 Commits

Author SHA1 Message Date
a1dceb6ff1
day18: perf: swap dijkstra for bfs for ~30% improvement
All checks were successful
test / AoC 2024 (push) Successful in 1m41s
2024-12-18 15:31:12 -08:00
3712b32634
grid: row and column iterators 2024-12-18 15:31:07 -08:00

View File

@ -99,8 +99,7 @@ pub struct Map {
impl<T: BufRead> From<T> for Map {
fn from(input: T) -> Self {
let grid = Grid::from(input);
let mut visited_from: Grid<DirectionSet> = Grid::new(grid.width() as i64);
visited_from.data.resize(grid.data.len(), DirectionSet::empty());
let visited_from = grid.same_shape(DirectionSet::empty());
let guard_pos = grid.find(&b'^').expect("Guard not found");
let guard_facing = FacingDirection::Up;
Self {