renamed row

This commit is contained in:
max.nuding 2022-12-12 14:20:10 +01:00
parent f2d6ff15e8
commit 7ea1b80afe
Failed to extract signature

View File

@ -14,20 +14,20 @@ pub fn run() {
let mut target: Coord = Default::default(); let mut target: Coord = Default::default();
let map = lines let map = lines
.enumerate() .enumerate()
.map(|(r, l)| { .map(|(row, l)| {
l.chars() l.chars()
.enumerate() .enumerate()
.map(|(col, c)| match c { .map(|(col, c)| match c {
'S' => { 'S' => {
start = Coord { start = Coord {
row: r, row,
col, col,
}; };
0 0
} }
'E' => { 'E' => {
target = Coord { target = Coord {
row: r, row,
col, col,
}; };
25 25
@ -45,7 +45,7 @@ pub fn run() {
#[cfg(feature = "part2")] #[cfg(feature = "part2")]
{ {
let starting_points = map let min = map
.iter() .iter()
.enumerate() .enumerate()
.flat_map(|(row, v)| { .flat_map(|(row, v)| {
@ -58,9 +58,6 @@ pub fn run() {
}) })
.collect_vec() .collect_vec()
}) })
.collect_vec();
let min = starting_points
.iter()
.filter_map(|start| bfs(&map, start.clone(), target.clone())) .filter_map(|start| bfs(&map, start.clone(), target.clone()))
.min() .min()
.unwrap(); .unwrap();