day20 cleanup
This commit is contained in:
@@ -280,7 +280,6 @@ fn bfs(map: &FieldMap, start: RealPoint, finish: RealPoint) -> usize {
|
|||||||
seen.insert(start);
|
seen.insert(start);
|
||||||
|
|
||||||
while let Some((p, d)) = open.pop_front() {
|
while let Some((p, d)) = open.pop_front() {
|
||||||
println!("{:?} {}", p, d);
|
|
||||||
if p == finish {
|
if p == finish {
|
||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
@@ -293,7 +292,6 @@ fn bfs(map: &FieldMap, start: RealPoint, finish: RealPoint) -> usize {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
panic!("no path found")
|
panic!("no path found")
|
||||||
PortalField
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
@@ -319,5 +317,8 @@ mod test {
|
|||||||
let input = std::fs::read_to_string("input/day20.txt").unwrap();
|
let input = std::fs::read_to_string("input/day20.txt").unwrap();
|
||||||
let maze = Maze::from(&input, PortalField::curried_factory);
|
let maze = Maze::from(&input, PortalField::curried_factory);
|
||||||
assert_eq!(maze.shortest_path(), 454);
|
assert_eq!(maze.shortest_path(), 454);
|
||||||
|
|
||||||
|
let maze = Maze::from(&input, DimensionField::curried_factory);
|
||||||
|
assert_eq!(maze.shortest_path(), 5744);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user