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

@@ -19,6 +19,11 @@ rstest = "0.18.2"
rstest_reuse = "0.6.0" rstest_reuse = "0.6.0"
dhat = "0.3.2" dhat = "0.3.2"
glam = "0.24.2" glam = "0.24.2"
petgraph = "0.6.4"
num = "0.4.1"
num-traits = "0.2.17"
rustworkx-core = "0.13.2"
pathfinding = "4.6.0"
[profile.dhat] [profile.dhat]

View File

@@ -11,7 +11,7 @@ repository.workspace = true
nom.workspace = true nom.workspace = true
nom_locate = {workspace = true } nom_locate = {workspace = true }
itertools.workspace = true itertools.workspace = true
glam = "0.24.2" glam.workspace = true
[dev-dependencies] [dev-dependencies]
rstest = {workspace = true} rstest = {workspace = true}

View File

@@ -12,7 +12,7 @@ nom = { workspace = true }
itertools = {workspace = true } itertools = {workspace = true }
nom_locate.workspace = true nom_locate.workspace = true
glam.workspace = true glam.workspace = true
pathfinding = "4.6.0" pathfinding.workspace = true
[dev-dependencies] [dev-dependencies]
rstest.workspace = true rstest.workspace = true

View File

@@ -10,7 +10,7 @@ repository.workspace = true
[dependencies] [dependencies]
nom = { workspace = true } nom = { workspace = true }
itertools = {workspace = true } itertools = {workspace = true }
num = "0.4.1" num.workspace = true
[dev-dependencies] [dev-dependencies]
rstest.workspace = true rstest.workspace = true

View File

@@ -12,4 +12,4 @@ nom = { workspace = true }
itertools = {workspace = true } itertools = {workspace = true }
glam.workspace = true glam.workspace = true
nom_locate.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] #[must_use]
pub fn part1(input: &str) -> String { pub fn part1(input: &str) -> String {
let maze = parse_input(input); let maze = parse_input(input);

View File

@@ -14,14 +14,13 @@ enum PointType {
OnlyUp, OnlyUp,
} }
impl PointType { /// day 23 part 2 of aoc 2023
fn next_possibles(self) -> Vec<IVec2> { ///
match self { /// # Arguments
_ => vec![IVec2::X, IVec2::Y, IVec2::NEG_X, IVec2::NEG_Y], /// - 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] #[must_use]
pub fn part2(input: &str) -> String { pub fn part2(input: &str) -> String {
let maze = parse_input(input); let maze = parse_input(input);
@@ -41,9 +40,8 @@ pub fn part2(input: &str) -> String {
.collect::<HashMap<_, _>>(); .collect::<HashMap<_, _>>();
maze.iter() maze.iter()
.flat_map(|(pos, point_type)| { .flat_map(|(pos, _point_type)| {
point_type [IVec2::X, IVec2::Y, IVec2::NEG_X, IVec2::NEG_Y]
.next_possibles()
.iter() .iter()
.copied() .copied()
.filter_map(|dir| { .filter_map(|dir| {

View File

@@ -11,4 +11,4 @@ repository.workspace = true
nom = { workspace = true } nom = { workspace = true }
itertools = {workspace = true } itertools = {workspace = true }
glam.workspace = true glam.workspace = true
num = "0.4.1" num.workspace = true

View File

@@ -10,5 +10,5 @@ repository.workspace = true
[dependencies] [dependencies]
nom = { workspace = true } nom = { workspace = true }
itertools = {workspace = true } itertools = {workspace = true }
petgraph = "0.6.4" petgraph.workspace = true
rustworkx-core = "0.13.2" rustworkx-core.workspace = true

View File

@@ -10,8 +10,8 @@ repository.workspace = true
[dependencies] [dependencies]
nom.workspace = true nom.workspace = true
itertools.workspace = true itertools.workspace = true
num = "0.4.1" num.workspace = true
num-traits = "0.2.17" num-traits.workspace = true
dhat = { workspace = true } dhat = { workspace = true }
[features] [features]