clean ups

This commit is contained in:
Dylan Thies
2023-12-29 13:34:59 -05:00
parent 1a9e6b39c0
commit 05951ebc8a
10 changed files with 30 additions and 20 deletions

View File

@@ -12,4 +12,4 @@ nom = { workspace = true }
itertools = {workspace = true }
glam.workspace = true
nom_locate.workspace = true
petgraph = "0.6.4"
petgraph = {workspace = true}

View File

@@ -26,6 +26,13 @@ impl PointType {
}
}
/// day 23 part 1 of aoc 2023
///
/// # Arguments
/// - input the input for today's puzzle
///
/// # Panics
/// panics whne it cannot parse the input OR when ever the number of game numbers is greater than
#[must_use]
pub fn part1(input: &str) -> String {
let maze = parse_input(input);

View File

@@ -14,14 +14,13 @@ enum PointType {
OnlyUp,
}
impl PointType {
fn next_possibles(self) -> Vec<IVec2> {
match self {
_ => vec![IVec2::X, IVec2::Y, IVec2::NEG_X, IVec2::NEG_Y],
}
}
}
/// day 23 part 2 of aoc 2023
///
/// # Arguments
/// - input the input for today's puzzle
///
/// # Panics
/// panics whne it cannot parse the input OR when ever the number of game numbers is greater than
#[must_use]
pub fn part2(input: &str) -> String {
let maze = parse_input(input);
@@ -41,9 +40,8 @@ pub fn part2(input: &str) -> String {
.collect::<HashMap<_, _>>();
maze.iter()
.flat_map(|(pos, point_type)| {
point_type
.next_possibles()
.flat_map(|(pos, _point_type)| {
[IVec2::X, IVec2::Y, IVec2::NEG_X, IVec2::NEG_Y]
.iter()
.copied()
.filter_map(|dir| {