mirror of
https://github.com/bertptrs/adventofcode.git
synced 2025-12-25 21:00:31 +01:00
Forgot to add sample, simplyfiy match
This commit is contained in:
@@ -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
10
2023/src/samples/03.txt
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
467..114..
|
||||||
|
...*......
|
||||||
|
..35..633.
|
||||||
|
......#...
|
||||||
|
617*......
|
||||||
|
.....+.58.
|
||||||
|
..592.....
|
||||||
|
......755.
|
||||||
|
...$.*....
|
||||||
|
.664.598..
|
||||||
Reference in New Issue
Block a user