don't re-parse every time

This commit is contained in:
Joe Ardent 2024-12-26 12:41:26 -08:00
parent 0dbc07cc94
commit d394c3211c

View file

@ -36,8 +36,9 @@ fn pt2(input: &str) -> usize {
} }
} }
let board = Board::new(input);
for loc in trace { for loc in trace {
board = Board::new(input); let mut board = board.clone();
let mut steps = HashSet::new(); let mut steps = HashSet::new();
board.set(loc, Cell::Obstacle); board.set(loc, Cell::Obstacle);
steps.insert(board.guard); steps.insert(board.guard);