From 35728df923257dd69854cabd819985973808520a Mon Sep 17 00:00:00 2001 From: Mathis Date: Thu, 21 Dec 2023 19:56:09 +0100 Subject: [PATCH] 2023-10: Add day 10 --- src/year_2023/day_10_pipe_maze/mod.rs | 25 ++++++++++++++++++++++ src/year_2023/day_10_pipe_maze/part_one.rs | 7 ++++++ 2 files changed, 32 insertions(+) create mode 100644 src/year_2023/day_10_pipe_maze/mod.rs create mode 100644 src/year_2023/day_10_pipe_maze/part_one.rs diff --git a/src/year_2023/day_10_pipe_maze/mod.rs b/src/year_2023/day_10_pipe_maze/mod.rs new file mode 100644 index 0000000..f70aabe --- /dev/null +++ b/src/year_2023/day_10_pipe_maze/mod.rs @@ -0,0 +1,25 @@ +pub mod part_one; +//pub mod part_two; +//pub mod common; + +use crate::utils::solution::Solution; +use crate::utils::input_reader; + +pub struct DaySolution ; + + +impl Solution for DaySolution { + + fn input_path(&self) -> &'static str { + "input/2023/day_10/input.txt" + } + + fn part_one(&self) -> String { + input_reader::read_input_file(self.input_path(), part_one::part_one) + } + + fn part_two(&self) -> String { + //input_reader::read_input_file(self.input_path, part_two::part_two) + String::from("Not implemented") + } +} diff --git a/src/year_2023/day_10_pipe_maze/part_one.rs b/src/year_2023/day_10_pipe_maze/part_one.rs new file mode 100644 index 0000000..f6f005b --- /dev/null +++ b/src/year_2023/day_10_pipe_maze/part_one.rs @@ -0,0 +1,7 @@ +pub fn part_one(input_lines: Vec) -> String { + input_lines + .iter() + .map(|line| line.parse::().unwrap()) + .sum::() + .to_string() +} \ No newline at end of file