Forgot to add sample, simplyfiy match

This commit is contained in:
2023-12-03 19:48:17 +01:00
parent af3ee23050
commit 6e6713bfc3
2 changed files with 11 additions and 6 deletions

View File

@@ -50,12 +50,7 @@ impl<'a> Index<usize> for Grid<'a> {
fn is_surrounded(grid: &Grid<'_>, y: usize, start: usize, last: usize) -> bool { fn is_surrounded(grid: &Grid<'_>, y: usize, start: usize, last: usize) -> bool {
fn is_symbol(c: u8) -> bool { fn is_symbol(c: u8) -> bool {
match c { !matches!(c, b'0'..=b'9' | b'.' | b'\n')
b'0'..=b'9' => false,
b'.' => false,
b'\n' => false,
_ => true,
}
} }
let x_min = start.saturating_sub(1); let x_min = start.saturating_sub(1);
let x_max = Ord::min(grid.width(), last + 2); let x_max = Ord::min(grid.width(), last + 2);

10
2023/src/samples/03.txt Normal file
View File

@@ -0,0 +1,10 @@
467..114..
...*......
..35..633.
......#...
617*......
.....+.58.
..592.....
......755.
...$.*....
.664.598..