Compare commits
2 commits
53816fed73
...
d394c3211c
Author | SHA1 | Date | |
---|---|---|---|
|
d394c3211c | ||
|
0dbc07cc94 |
1 changed files with 7 additions and 6 deletions
|
@ -6,7 +6,7 @@ use std::{
|
|||
use winnow::{
|
||||
PResult, Parser,
|
||||
ascii::{newline, till_line_ending},
|
||||
combinator::{alt, repeat, separated},
|
||||
combinator::{alt, opt, repeat, separated},
|
||||
};
|
||||
|
||||
fn main() {
|
||||
|
@ -36,8 +36,9 @@ fn pt2(input: &str) -> usize {
|
|||
}
|
||||
}
|
||||
|
||||
let board = Board::new(input);
|
||||
for loc in trace {
|
||||
board = Board::new(input);
|
||||
let mut board = board.clone();
|
||||
let mut steps = HashSet::new();
|
||||
board.set(loc, Cell::Obstacle);
|
||||
steps.insert(board.guard);
|
||||
|
@ -230,9 +231,9 @@ fn parse(input: &str) -> PResult<Board> {
|
|||
let mut gdir = Dir::N;
|
||||
let mut loc = Loc(0, 0);
|
||||
|
||||
let mut input = input;
|
||||
let cells: Vec<Vec<Cell>> = separated(1.., parse_line, newline)
|
||||
.parse_next(&mut input)
|
||||
let (cells, _): (Vec<Vec<Cell>>, _) =
|
||||
winnow::combinator::seq!(separated(1.., parse_line, newline), opt(newline))
|
||||
.parse(input)
|
||||
.unwrap();
|
||||
|
||||
for (row, line) in cells.iter().enumerate() {
|
||||
|
|
Loading…
Reference in a new issue