Compare commits
No commits in common. "d394c3211c1ea41c74ddf6fe603282fb6849fdb3" and "53816fed73dcc0e787e93c7292fe1b918110c376" have entirely different histories.
d394c3211c
...
53816fed73
1 changed files with 6 additions and 7 deletions
|
@ -6,7 +6,7 @@ use std::{
|
||||||
use winnow::{
|
use winnow::{
|
||||||
PResult, Parser,
|
PResult, Parser,
|
||||||
ascii::{newline, till_line_ending},
|
ascii::{newline, till_line_ending},
|
||||||
combinator::{alt, opt, repeat, separated},
|
combinator::{alt, repeat, separated},
|
||||||
};
|
};
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
@ -36,9 +36,8 @@ fn pt2(input: &str) -> usize {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let board = Board::new(input);
|
|
||||||
for loc in trace {
|
for loc in trace {
|
||||||
let mut board = board.clone();
|
board = Board::new(input);
|
||||||
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);
|
||||||
|
@ -231,9 +230,9 @@ fn parse(input: &str) -> PResult<Board> {
|
||||||
let mut gdir = Dir::N;
|
let mut gdir = Dir::N;
|
||||||
let mut loc = Loc(0, 0);
|
let mut loc = Loc(0, 0);
|
||||||
|
|
||||||
let (cells, _): (Vec<Vec<Cell>>, _) =
|
let mut input = input;
|
||||||
winnow::combinator::seq!(separated(1.., parse_line, newline), opt(newline))
|
let cells: Vec<Vec<Cell>> = separated(1.., parse_line, newline)
|
||||||
.parse(input)
|
.parse_next(&mut input)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
for (row, line) in cells.iter().enumerate() {
|
for (row, line) in cells.iter().enumerate() {
|
||||||
|
|
Loading…
Reference in a new issue