diff --git a/scripts/new.py b/scripts/new.py deleted file mode 100644 index 6f5fd3b..0000000 --- a/scripts/new.py +++ /dev/null @@ -1,19 +0,0 @@ -def create_and_populate_file(file_name, content): - try: - with open(file_name, 'w') as file: - file.write(content) - print(f"File {file_name} created and populated successfully.") - except Exception as e: - print(f"Error: {e}") - -def main(): - # Define the file names and template content - file_names = ["file1.txt", "file2.txt", "file3.txt"] - template_content = "This is a template file.\nYou can replace this content." - - # Create and populate each file - for file_name in file_names: - create_and_populate_file(file_name, template_content) - -if __name__ == "__main__": - main() \ No newline at end of file diff --git a/src/input/day08 b/src/input/day08 new file mode 100644 index 0000000..e69de29 diff --git a/src/input/day08_test1 b/src/input/day08_test1 new file mode 100644 index 0000000..e69de29 diff --git a/src/input/day08_test2 b/src/input/day08_test2 new file mode 100644 index 0000000..e69de29 diff --git a/src/input/day09 b/src/input/day09 new file mode 100644 index 0000000..e69de29 diff --git a/src/input/day09_test1 b/src/input/day09_test1 new file mode 100644 index 0000000..e69de29 diff --git a/src/input/day09_test2 b/src/input/day09_test2 new file mode 100644 index 0000000..e69de29 diff --git a/src/input/day10 b/src/input/day10 new file mode 100644 index 0000000..e69de29 diff --git a/src/input/day10_test1 b/src/input/day10_test1 new file mode 100644 index 0000000..e69de29 diff --git a/src/input/day10_test2 b/src/input/day10_test2 new file mode 100644 index 0000000..e69de29 diff --git a/src/input/day11 b/src/input/day11 new file mode 100644 index 0000000..e69de29 diff --git a/src/input/day11_test1 b/src/input/day11_test1 new file mode 100644 index 0000000..e69de29 diff --git a/src/input/day11_test2 b/src/input/day11_test2 new file mode 100644 index 0000000..e69de29 diff --git a/src/input/day12 b/src/input/day12 new file mode 100644 index 0000000..e69de29 diff --git a/src/input/day12_test1 b/src/input/day12_test1 new file mode 100644 index 0000000..e69de29 diff --git a/src/input/day12_test2 b/src/input/day12_test2 new file mode 100644 index 0000000..e69de29 diff --git a/src/input/day13 b/src/input/day13 new file mode 100644 index 0000000..e69de29 diff --git a/src/input/day13_test1 b/src/input/day13_test1 new file mode 100644 index 0000000..e69de29 diff --git a/src/input/day13_test2 b/src/input/day13_test2 new file mode 100644 index 0000000..e69de29 diff --git a/src/input/day14 b/src/input/day14 new file mode 100644 index 0000000..e69de29 diff --git a/src/input/day14_test1 b/src/input/day14_test1 new file mode 100644 index 0000000..e69de29 diff --git a/src/input/day14_test2 b/src/input/day14_test2 new file mode 100644 index 0000000..e69de29 diff --git a/src/input/day15 b/src/input/day15 new file mode 100644 index 0000000..e69de29 diff --git a/src/input/day15_test1 b/src/input/day15_test1 new file mode 100644 index 0000000..e69de29 diff --git a/src/input/day15_test2 b/src/input/day15_test2 new file mode 100644 index 0000000..e69de29 diff --git a/src/input/day16 b/src/input/day16 new file mode 100644 index 0000000..e69de29 diff --git a/src/input/day16_test1 b/src/input/day16_test1 new file mode 100644 index 0000000..e69de29 diff --git a/src/input/day16_test2 b/src/input/day16_test2 new file mode 100644 index 0000000..e69de29 diff --git a/src/input/day17 b/src/input/day17 new file mode 100644 index 0000000..e69de29 diff --git a/src/input/day17_test1 b/src/input/day17_test1 new file mode 100644 index 0000000..e69de29 diff --git a/src/input/day17_test2 b/src/input/day17_test2 new file mode 100644 index 0000000..e69de29 diff --git a/src/input/day18 b/src/input/day18 new file mode 100644 index 0000000..e69de29 diff --git a/src/input/day18_test1 b/src/input/day18_test1 new file mode 100644 index 0000000..e69de29 diff --git a/src/input/day18_test2 b/src/input/day18_test2 new file mode 100644 index 0000000..e69de29 diff --git a/src/input/day19 b/src/input/day19 new file mode 100644 index 0000000..e69de29 diff --git a/src/input/day19_test1 b/src/input/day19_test1 new file mode 100644 index 0000000..e69de29 diff --git a/src/input/day19_test2 b/src/input/day19_test2 new file mode 100644 index 0000000..e69de29 diff --git a/src/input/day20 b/src/input/day20 new file mode 100644 index 0000000..e69de29 diff --git a/src/input/day20_test1 b/src/input/day20_test1 new file mode 100644 index 0000000..e69de29 diff --git a/src/input/day20_test2 b/src/input/day20_test2 new file mode 100644 index 0000000..e69de29 diff --git a/src/input/day21 b/src/input/day21 new file mode 100644 index 0000000..e69de29 diff --git a/src/input/day21_test1 b/src/input/day21_test1 new file mode 100644 index 0000000..e69de29 diff --git a/src/input/day21_test2 b/src/input/day21_test2 new file mode 100644 index 0000000..e69de29 diff --git a/src/input/day22 b/src/input/day22 new file mode 100644 index 0000000..e69de29 diff --git a/src/input/day22_test1 b/src/input/day22_test1 new file mode 100644 index 0000000..e69de29 diff --git a/src/input/day22_test2 b/src/input/day22_test2 new file mode 100644 index 0000000..e69de29 diff --git a/src/input/day23 b/src/input/day23 new file mode 100644 index 0000000..e69de29 diff --git a/src/input/day23_test1 b/src/input/day23_test1 new file mode 100644 index 0000000..e69de29 diff --git a/src/input/day23_test2 b/src/input/day23_test2 new file mode 100644 index 0000000..e69de29 diff --git a/src/input/day24 b/src/input/day24 new file mode 100644 index 0000000..e69de29 diff --git a/src/input/day24_test1 b/src/input/day24_test1 new file mode 100644 index 0000000..e69de29 diff --git a/src/input/day24_test2 b/src/input/day24_test2 new file mode 100644 index 0000000..e69de29 diff --git a/src/input/day25 b/src/input/day25 new file mode 100644 index 0000000..e69de29 diff --git a/src/input/day25_test1 b/src/input/day25_test1 new file mode 100644 index 0000000..e69de29 diff --git a/src/input/day25_test2 b/src/input/day25_test2 new file mode 100644 index 0000000..e69de29 diff --git a/src/main.rs b/src/main.rs index 2566ac4..fc6323a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,7 +1,7 @@ mod solutions; mod utils; -use std::error::Error; +use std::{error::Error, time::SystemTime}; use solutions::*; @@ -13,18 +13,38 @@ async fn main() -> Result<(), Box> { Box::new(day03::Day03 {}), Box::new(day04::Day04 {}), Box::new(day05::Day05 {}), - Box::new(day06::Day06 {}), - Box::new(day07::Day07 {}), + // Box::new(day06::Day06 {}), + // Box::new(day07::Day07 {}), + // Box::new(day08::Day08 {}), + // Box::new(day09::Day09 {}), + // Box::new(day10::Day10 {}), + // Box::new(day11::Day11 {}), + // Box::new(day12::Day12 {}), + // Box::new(day13::Day13 {}), + // Box::new(day14::Day14 {}), + // Box::new(day15::Day15 {}), + // Box::new(day16::Day16 {}), + // Box::new(day17::Day17 {}), + // Box::new(day18::Day18 {}), + // Box::new(day19::Day19 {}), + // Box::new(day20::Day20 {}), + // Box::new(day21::Day21 {}), + // Box::new(day22::Day22 {}), + // Box::new(day23::Day23 {}), + // Box::new(day24::Day24 {}), + // Box::new(day25::Day25 {}), ]; let mut t = vec![]; // Run through and generate solutions - for day in days.leak().iter().rev() { + for day in days.leak() { let task = tokio::spawn(async { day.run().unwrap() }); t.push(task); } + let start_time = SystemTime::now(); + let mut days = vec![]; for thread in t { days.push(thread.await?); @@ -34,8 +54,10 @@ async fn main() -> Result<(), Box> { println!("========= Day {} ==========", day.day); println!("Part1 Result: {}", day.part1); println!("Part2 Result: {}", day.part2); - println!("========= {}ms =========", day.time.as_millis()); + println!("========= {}ms =========\n", day.time.as_millis()); } + println!("Ran AoC 2023 in {}ms", SystemTime::now().duration_since(start_time)?.as_millis()); + Ok(()) } diff --git a/src/solutions/day08.rs b/src/solutions/day08.rs new file mode 100644 index 0000000..4f5625d --- /dev/null +++ b/src/solutions/day08.rs @@ -0,0 +1,66 @@ +use super::Solution; + +pub struct Day08 {} + +impl Solution for Day08 { + fn part1( + &self, + _input: &mut Vec, + ) -> Result, Box> { + Ok(Box::new("Ready")) + } + + fn part2( + &self, + _input: &mut Vec, + ) -> Result, Box> { + Ok(Box::new("Ready")) + } + + fn get_day(&self) -> u8 { + 8 + } +} + +impl Day08 {} + +/// Test from puzzle input +#[cfg(test)] +mod test { + use super::*; + use crate::*; + + #[test] + fn part1() { + let challenge = day08::Day08 {}; + + //Complete the Challenge + let answer = challenge + .part1( + utils::get_input(challenge.get_day(), utils::InputType::Test1) + .unwrap() + .as_mut(), + ) + .unwrap() + .to_string(); + + assert_eq!(answer, "Ready"); + } + + #[test] + fn part2() { + let challenge = day08::Day08 {}; + + //Complete the Challenge + let answer = challenge + .part2( + utils::get_input(challenge.get_day(), utils::InputType::Test2) + .unwrap() + .as_mut(), + ) + .unwrap() + .to_string(); + + assert_eq!(answer, "Ready"); + } +} diff --git a/src/solutions/day09.rs b/src/solutions/day09.rs new file mode 100644 index 0000000..440897e --- /dev/null +++ b/src/solutions/day09.rs @@ -0,0 +1,66 @@ +use super::Solution; + +pub struct Day09 {} + +impl Solution for Day09 { + fn part1( + &self, + _input: &mut Vec, + ) -> Result, Box> { + Ok(Box::new("Ready")) + } + + fn part2( + &self, + _input: &mut Vec, + ) -> Result, Box> { + Ok(Box::new("Ready")) + } + + fn get_day(&self) -> u8 { + 9 + } +} + +impl Day09 {} + +/// Test from puzzle input +#[cfg(test)] +mod test { + use super::*; + use crate::*; + + #[test] + fn part1() { + let challenge = day09::Day09 {}; + + //Complete the Challenge + let answer = challenge + .part1( + utils::get_input(challenge.get_day(), utils::InputType::Test1) + .unwrap() + .as_mut(), + ) + .unwrap() + .to_string(); + + assert_eq!(answer, "Ready"); + } + + #[test] + fn part2() { + let challenge = day09::Day09 {}; + + //Complete the Challenge + let answer = challenge + .part2( + utils::get_input(challenge.get_day(), utils::InputType::Test2) + .unwrap() + .as_mut(), + ) + .unwrap() + .to_string(); + + assert_eq!(answer, "Ready"); + } +} diff --git a/src/solutions/day10.rs b/src/solutions/day10.rs new file mode 100644 index 0000000..1cefb7b --- /dev/null +++ b/src/solutions/day10.rs @@ -0,0 +1,66 @@ +use super::Solution; + +pub struct Day10 {} + +impl Solution for Day10 { + fn part1( + &self, + _input: &mut Vec, + ) -> Result, Box> { + Ok(Box::new("Ready")) + } + + fn part2( + &self, + _input: &mut Vec, + ) -> Result, Box> { + Ok(Box::new("Ready")) + } + + fn get_day(&self) -> u8 { + 10 + } +} + +impl Day10 {} + +/// Test from puzzle input +#[cfg(test)] +mod test { + use super::*; + use crate::*; + + #[test] + fn part1() { + let challenge = day10::Day10 {}; + + //Complete the Challenge + let answer = challenge + .part1( + utils::get_input(challenge.get_day(), utils::InputType::Test1) + .unwrap() + .as_mut(), + ) + .unwrap() + .to_string(); + + assert_eq!(answer, "Ready"); + } + + #[test] + fn part2() { + let challenge = day10::Day10 {}; + + //Complete the Challenge + let answer = challenge + .part2( + utils::get_input(challenge.get_day(), utils::InputType::Test2) + .unwrap() + .as_mut(), + ) + .unwrap() + .to_string(); + + assert_eq!(answer, "Ready"); + } +} \ No newline at end of file diff --git a/src/solutions/day11.rs b/src/solutions/day11.rs new file mode 100644 index 0000000..ba2a1f4 --- /dev/null +++ b/src/solutions/day11.rs @@ -0,0 +1,66 @@ +use super::Solution; + +pub struct Day11 {} + +impl Solution for Day11 { + fn part1( + &self, + _input: &mut Vec, + ) -> Result, Box> { + Ok(Box::new("Ready")) + } + + fn part2( + &self, + _input: &mut Vec, + ) -> Result, Box> { + Ok(Box::new("Ready")) + } + + fn get_day(&self) -> u8 { + 11 + } +} + +impl Day11 {} + +/// Test from puzzle input +#[cfg(test)] +mod test { + use super::*; + use crate::*; + + #[test] + fn part1() { + let challenge = day11::Day11 {}; + + //Complete the Challenge + let answer = challenge + .part1( + utils::get_input(challenge.get_day(), utils::InputType::Test1) + .unwrap() + .as_mut(), + ) + .unwrap() + .to_string(); + + assert_eq!(answer, "Ready"); + } + + #[test] + fn part2() { + let challenge = day11::Day11 {}; + + //Complete the Challenge + let answer = challenge + .part2( + utils::get_input(challenge.get_day(), utils::InputType::Test2) + .unwrap() + .as_mut(), + ) + .unwrap() + .to_string(); + + assert_eq!(answer, "Ready"); + } +} \ No newline at end of file diff --git a/src/solutions/day12.rs b/src/solutions/day12.rs new file mode 100644 index 0000000..5bf7b2a --- /dev/null +++ b/src/solutions/day12.rs @@ -0,0 +1,66 @@ +use super::Solution; + +pub struct Day12 {} + +impl Solution for Day12 { + fn part1( + &self, + _input: &mut Vec, + ) -> Result, Box> { + Ok(Box::new("Ready")) + } + + fn part2( + &self, + _input: &mut Vec, + ) -> Result, Box> { + Ok(Box::new("Ready")) + } + + fn get_day(&self) -> u8 { + 12 + } +} + +impl Day12 {} + +/// Test from puzzle input +#[cfg(test)] +mod test { + use super::*; + use crate::*; + + #[test] + fn part1() { + let challenge = day12::Day12 {}; + + //Complete the Challenge + let answer = challenge + .part1( + utils::get_input(challenge.get_day(), utils::InputType::Test1) + .unwrap() + .as_mut(), + ) + .unwrap() + .to_string(); + + assert_eq!(answer, "Ready"); + } + + #[test] + fn part2() { + let challenge = day12::Day12 {}; + + //Complete the Challenge + let answer = challenge + .part2( + utils::get_input(challenge.get_day(), utils::InputType::Test2) + .unwrap() + .as_mut(), + ) + .unwrap() + .to_string(); + + assert_eq!(answer, "Ready"); + } +} \ No newline at end of file diff --git a/src/solutions/day13.rs b/src/solutions/day13.rs new file mode 100644 index 0000000..f0b82de --- /dev/null +++ b/src/solutions/day13.rs @@ -0,0 +1,66 @@ +use super::Solution; + +pub struct Day13 {} + +impl Solution for Day13 { + fn part1( + &self, + _input: &mut Vec, + ) -> Result, Box> { + Ok(Box::new("Ready")) + } + + fn part2( + &self, + _input: &mut Vec, + ) -> Result, Box> { + Ok(Box::new("Ready")) + } + + fn get_day(&self) -> u8 { + 13 + } +} + +impl Day13 {} + +/// Test from puzzle input +#[cfg(test)] +mod test { + use super::*; + use crate::*; + + #[test] + fn part1() { + let challenge = day13::Day13 {}; + + //Complete the Challenge + let answer = challenge + .part1( + utils::get_input(challenge.get_day(), utils::InputType::Test1) + .unwrap() + .as_mut(), + ) + .unwrap() + .to_string(); + + assert_eq!(answer, "Ready"); + } + + #[test] + fn part2() { + let challenge = day13::Day13 {}; + + //Complete the Challenge + let answer = challenge + .part2( + utils::get_input(challenge.get_day(), utils::InputType::Test2) + .unwrap() + .as_mut(), + ) + .unwrap() + .to_string(); + + assert_eq!(answer, "Ready"); + } +} \ No newline at end of file diff --git a/src/solutions/day14.rs b/src/solutions/day14.rs new file mode 100644 index 0000000..ef52ad0 --- /dev/null +++ b/src/solutions/day14.rs @@ -0,0 +1,66 @@ +use super::Solution; + +pub struct Day14 {} + +impl Solution for Day14 { + fn part1( + &self, + _input: &mut Vec, + ) -> Result, Box> { + Ok(Box::new("Ready")) + } + + fn part2( + &self, + _input: &mut Vec, + ) -> Result, Box> { + Ok(Box::new("Ready")) + } + + fn get_day(&self) -> u8 { + 14 + } +} + +impl Day14 {} + +/// Test from puzzle input +#[cfg(test)] +mod test { + use super::*; + use crate::*; + + #[test] + fn part1() { + let challenge = day14::Day14 {}; + + //Complete the Challenge + let answer = challenge + .part1( + utils::get_input(challenge.get_day(), utils::InputType::Test1) + .unwrap() + .as_mut(), + ) + .unwrap() + .to_string(); + + assert_eq!(answer, "Ready"); + } + + #[test] + fn part2() { + let challenge = day14::Day14 {}; + + //Complete the Challenge + let answer = challenge + .part2( + utils::get_input(challenge.get_day(), utils::InputType::Test2) + .unwrap() + .as_mut(), + ) + .unwrap() + .to_string(); + + assert_eq!(answer, "Ready"); + } +} \ No newline at end of file diff --git a/src/solutions/day15.rs b/src/solutions/day15.rs new file mode 100644 index 0000000..8e76253 --- /dev/null +++ b/src/solutions/day15.rs @@ -0,0 +1,66 @@ +use super::Solution; + +pub struct Day15 {} + +impl Solution for Day15 { + fn part1( + &self, + _input: &mut Vec, + ) -> Result, Box> { + Ok(Box::new("Ready")) + } + + fn part2( + &self, + _input: &mut Vec, + ) -> Result, Box> { + Ok(Box::new("Ready")) + } + + fn get_day(&self) -> u8 { + 15 + } +} + +impl Day15 {} + +/// Test from puzzle input +#[cfg(test)] +mod test { + use super::*; + use crate::*; + + #[test] + fn part1() { + let challenge = day15::Day15 {}; + + //Complete the Challenge + let answer = challenge + .part1( + utils::get_input(challenge.get_day(), utils::InputType::Test1) + .unwrap() + .as_mut(), + ) + .unwrap() + .to_string(); + + assert_eq!(answer, "Ready"); + } + + #[test] + fn part2() { + let challenge = day15::Day15 {}; + + //Complete the Challenge + let answer = challenge + .part2( + utils::get_input(challenge.get_day(), utils::InputType::Test2) + .unwrap() + .as_mut(), + ) + .unwrap() + .to_string(); + + assert_eq!(answer, "Ready"); + } +} \ No newline at end of file diff --git a/src/solutions/day16.rs b/src/solutions/day16.rs new file mode 100644 index 0000000..e7ef67c --- /dev/null +++ b/src/solutions/day16.rs @@ -0,0 +1,66 @@ +use super::Solution; + +pub struct Day16 {} + +impl Solution for Day16 { + fn part1( + &self, + _input: &mut Vec, + ) -> Result, Box> { + Ok(Box::new("Ready")) + } + + fn part2( + &self, + _input: &mut Vec, + ) -> Result, Box> { + Ok(Box::new("Ready")) + } + + fn get_day(&self) -> u8 { + 16 + } +} + +impl Day16 {} + +/// Test from puzzle input +#[cfg(test)] +mod test { + use super::*; + use crate::*; + + #[test] + fn part1() { + let challenge = day16::Day16 {}; + + //Complete the Challenge + let answer = challenge + .part1( + utils::get_input(challenge.get_day(), utils::InputType::Test1) + .unwrap() + .as_mut(), + ) + .unwrap() + .to_string(); + + assert_eq!(answer, "Ready"); + } + + #[test] + fn part2() { + let challenge = day16::Day16 {}; + + //Complete the Challenge + let answer = challenge + .part2( + utils::get_input(challenge.get_day(), utils::InputType::Test2) + .unwrap() + .as_mut(), + ) + .unwrap() + .to_string(); + + assert_eq!(answer, "Ready"); + } +} \ No newline at end of file diff --git a/src/solutions/day17.rs b/src/solutions/day17.rs new file mode 100644 index 0000000..2106b43 --- /dev/null +++ b/src/solutions/day17.rs @@ -0,0 +1,66 @@ +use super::Solution; + +pub struct Day17 {} + +impl Solution for Day17 { + fn part1( + &self, + _input: &mut Vec, + ) -> Result, Box> { + Ok(Box::new("Ready")) + } + + fn part2( + &self, + _input: &mut Vec, + ) -> Result, Box> { + Ok(Box::new("Ready")) + } + + fn get_day(&self) -> u8 { + 17 + } +} + +impl Day17 {} + +/// Test from puzzle input +#[cfg(test)] +mod test { + use super::*; + use crate::*; + + #[test] + fn part1() { + let challenge = day17::Day17 {}; + + //Complete the Challenge + let answer = challenge + .part1( + utils::get_input(challenge.get_day(), utils::InputType::Test1) + .unwrap() + .as_mut(), + ) + .unwrap() + .to_string(); + + assert_eq!(answer, "Ready"); + } + + #[test] + fn part2() { + let challenge = day17::Day17 {}; + + //Complete the Challenge + let answer = challenge + .part2( + utils::get_input(challenge.get_day(), utils::InputType::Test2) + .unwrap() + .as_mut(), + ) + .unwrap() + .to_string(); + + assert_eq!(answer, "Ready"); + } +} \ No newline at end of file diff --git a/src/solutions/day18.rs b/src/solutions/day18.rs new file mode 100644 index 0000000..c71126c --- /dev/null +++ b/src/solutions/day18.rs @@ -0,0 +1,66 @@ +use super::Solution; + +pub struct Day18 {} + +impl Solution for Day18 { + fn part1( + &self, + _input: &mut Vec, + ) -> Result, Box> { + Ok(Box::new("Ready")) + } + + fn part2( + &self, + _input: &mut Vec, + ) -> Result, Box> { + Ok(Box::new("Ready")) + } + + fn get_day(&self) -> u8 { + 18 + } +} + +impl Day18 {} + +/// Test from puzzle input +#[cfg(test)] +mod test { + use super::*; + use crate::*; + + #[test] + fn part1() { + let challenge = day18::Day18 {}; + + //Complete the Challenge + let answer = challenge + .part1( + utils::get_input(challenge.get_day(), utils::InputType::Test1) + .unwrap() + .as_mut(), + ) + .unwrap() + .to_string(); + + assert_eq!(answer, "Ready"); + } + + #[test] + fn part2() { + let challenge = day18::Day18 {}; + + //Complete the Challenge + let answer = challenge + .part2( + utils::get_input(challenge.get_day(), utils::InputType::Test2) + .unwrap() + .as_mut(), + ) + .unwrap() + .to_string(); + + assert_eq!(answer, "Ready"); + } +} \ No newline at end of file diff --git a/src/solutions/day19.rs b/src/solutions/day19.rs new file mode 100644 index 0000000..82771cb --- /dev/null +++ b/src/solutions/day19.rs @@ -0,0 +1,66 @@ +use super::Solution; + +pub struct Day19 {} + +impl Solution for Day19 { + fn part1( + &self, + _input: &mut Vec, + ) -> Result, Box> { + Ok(Box::new("Ready")) + } + + fn part2( + &self, + _input: &mut Vec, + ) -> Result, Box> { + Ok(Box::new("Ready")) + } + + fn get_day(&self) -> u8 { + 19 + } +} + +impl Day19 {} + +/// Test from puzzle input +#[cfg(test)] +mod test { + use super::*; + use crate::*; + + #[test] + fn part1() { + let challenge = day19::Day19 {}; + + //Complete the Challenge + let answer = challenge + .part1( + utils::get_input(challenge.get_day(), utils::InputType::Test1) + .unwrap() + .as_mut(), + ) + .unwrap() + .to_string(); + + assert_eq!(answer, "Ready"); + } + + #[test] + fn part2() { + let challenge = day19::Day19 {}; + + //Complete the Challenge + let answer = challenge + .part2( + utils::get_input(challenge.get_day(), utils::InputType::Test2) + .unwrap() + .as_mut(), + ) + .unwrap() + .to_string(); + + assert_eq!(answer, "Ready"); + } +} \ No newline at end of file diff --git a/src/solutions/day20.rs b/src/solutions/day20.rs new file mode 100644 index 0000000..90e4d2e --- /dev/null +++ b/src/solutions/day20.rs @@ -0,0 +1,66 @@ +use super::Solution; + +pub struct Day20 {} + +impl Solution for Day20 { + fn part1( + &self, + _input: &mut Vec, + ) -> Result, Box> { + Ok(Box::new("Ready")) + } + + fn part2( + &self, + _input: &mut Vec, + ) -> Result, Box> { + Ok(Box::new("Ready")) + } + + fn get_day(&self) -> u8 { + 20 + } +} + +impl Day20 {} + +/// Test from puzzle input +#[cfg(test)] +mod test { + use super::*; + use crate::*; + + #[test] + fn part1() { + let challenge = day20::Day20 {}; + + //Complete the Challenge + let answer = challenge + .part1( + utils::get_input(challenge.get_day(), utils::InputType::Test1) + .unwrap() + .as_mut(), + ) + .unwrap() + .to_string(); + + assert_eq!(answer, "Ready"); + } + + #[test] + fn part2() { + let challenge = day20::Day20 {}; + + //Complete the Challenge + let answer = challenge + .part2( + utils::get_input(challenge.get_day(), utils::InputType::Test2) + .unwrap() + .as_mut(), + ) + .unwrap() + .to_string(); + + assert_eq!(answer, "Ready"); + } +} \ No newline at end of file diff --git a/src/solutions/day21.rs b/src/solutions/day21.rs new file mode 100644 index 0000000..f52e993 --- /dev/null +++ b/src/solutions/day21.rs @@ -0,0 +1,66 @@ +use super::Solution; + +pub struct Day21 {} + +impl Solution for Day21 { + fn part1( + &self, + _input: &mut Vec, + ) -> Result, Box> { + Ok(Box::new("Ready")) + } + + fn part2( + &self, + _input: &mut Vec, + ) -> Result, Box> { + Ok(Box::new("Ready")) + } + + fn get_day(&self) -> u8 { + 21 + } +} + +impl Day21 {} + +/// Test from puzzle input +#[cfg(test)] +mod test { + use super::*; + use crate::*; + + #[test] + fn part1() { + let challenge = day21::Day21 {}; + + //Complete the Challenge + let answer = challenge + .part1( + utils::get_input(challenge.get_day(), utils::InputType::Test1) + .unwrap() + .as_mut(), + ) + .unwrap() + .to_string(); + + assert_eq!(answer, "Ready"); + } + + #[test] + fn part2() { + let challenge = day21::Day21 {}; + + //Complete the Challenge + let answer = challenge + .part2( + utils::get_input(challenge.get_day(), utils::InputType::Test2) + .unwrap() + .as_mut(), + ) + .unwrap() + .to_string(); + + assert_eq!(answer, "Ready"); + } +} \ No newline at end of file diff --git a/src/solutions/day22.rs b/src/solutions/day22.rs new file mode 100644 index 0000000..99adc58 --- /dev/null +++ b/src/solutions/day22.rs @@ -0,0 +1,66 @@ +use super::Solution; + +pub struct Day22 {} + +impl Solution for Day22 { + fn part1( + &self, + _input: &mut Vec, + ) -> Result, Box> { + Ok(Box::new("Ready")) + } + + fn part2( + &self, + _input: &mut Vec, + ) -> Result, Box> { + Ok(Box::new("Ready")) + } + + fn get_day(&self) -> u8 { + 22 + } +} + +impl Day22 {} + +/// Test from puzzle input +#[cfg(test)] +mod test { + use super::*; + use crate::*; + + #[test] + fn part1() { + let challenge = day22::Day22 {}; + + //Complete the Challenge + let answer = challenge + .part1( + utils::get_input(challenge.get_day(), utils::InputType::Test1) + .unwrap() + .as_mut(), + ) + .unwrap() + .to_string(); + + assert_eq!(answer, "Ready"); + } + + #[test] + fn part2() { + let challenge = day22::Day22 {}; + + //Complete the Challenge + let answer = challenge + .part2( + utils::get_input(challenge.get_day(), utils::InputType::Test2) + .unwrap() + .as_mut(), + ) + .unwrap() + .to_string(); + + assert_eq!(answer, "Ready"); + } +} \ No newline at end of file diff --git a/src/solutions/day23.rs b/src/solutions/day23.rs new file mode 100644 index 0000000..09353ab --- /dev/null +++ b/src/solutions/day23.rs @@ -0,0 +1,66 @@ +use super::Solution; + +pub struct Day23 {} + +impl Solution for Day23 { + fn part1( + &self, + _input: &mut Vec, + ) -> Result, Box> { + Ok(Box::new("Ready")) + } + + fn part2( + &self, + _input: &mut Vec, + ) -> Result, Box> { + Ok(Box::new("Ready")) + } + + fn get_day(&self) -> u8 { + 23 + } +} + +impl Day23 {} + +/// Test from puzzle input +#[cfg(test)] +mod test { + use super::*; + use crate::*; + + #[test] + fn part1() { + let challenge = day23::Day23 {}; + + //Complete the Challenge + let answer = challenge + .part1( + utils::get_input(challenge.get_day(), utils::InputType::Test1) + .unwrap() + .as_mut(), + ) + .unwrap() + .to_string(); + + assert_eq!(answer, "Ready"); + } + + #[test] + fn part2() { + let challenge = day23::Day23 {}; + + //Complete the Challenge + let answer = challenge + .part2( + utils::get_input(challenge.get_day(), utils::InputType::Test2) + .unwrap() + .as_mut(), + ) + .unwrap() + .to_string(); + + assert_eq!(answer, "Ready"); + } +} \ No newline at end of file diff --git a/src/solutions/day24.rs b/src/solutions/day24.rs new file mode 100644 index 0000000..671b699 --- /dev/null +++ b/src/solutions/day24.rs @@ -0,0 +1,66 @@ +use super::Solution; + +pub struct Day24 {} + +impl Solution for Day24 { + fn part1( + &self, + _input: &mut Vec, + ) -> Result, Box> { + Ok(Box::new("Ready")) + } + + fn part2( + &self, + _input: &mut Vec, + ) -> Result, Box> { + Ok(Box::new("Ready")) + } + + fn get_day(&self) -> u8 { + 24 + } +} + +impl Day24 {} + +/// Test from puzzle input +#[cfg(test)] +mod test { + use super::*; + use crate::*; + + #[test] + fn part1() { + let challenge = day24::Day24 {}; + + //Complete the Challenge + let answer = challenge + .part1( + utils::get_input(challenge.get_day(), utils::InputType::Test1) + .unwrap() + .as_mut(), + ) + .unwrap() + .to_string(); + + assert_eq!(answer, "Ready"); + } + + #[test] + fn part2() { + let challenge = day24::Day24 {}; + + //Complete the Challenge + let answer = challenge + .part2( + utils::get_input(challenge.get_day(), utils::InputType::Test2) + .unwrap() + .as_mut(), + ) + .unwrap() + .to_string(); + + assert_eq!(answer, "Ready"); + } +} \ No newline at end of file diff --git a/src/solutions/day25.rs b/src/solutions/day25.rs new file mode 100644 index 0000000..9923219 --- /dev/null +++ b/src/solutions/day25.rs @@ -0,0 +1,66 @@ +use super::Solution; + +pub struct Day25 {} + +impl Solution for Day25 { + fn part1( + &self, + _input: &mut Vec, + ) -> Result, Box> { + Ok(Box::new("Ready")) + } + + fn part2( + &self, + _input: &mut Vec, + ) -> Result, Box> { + Ok(Box::new("Ready")) + } + + fn get_day(&self) -> u8 { + 25 + } +} + +impl Day25 {} + +/// Test from puzzle input +#[cfg(test)] +mod test { + use super::*; + use crate::*; + + #[test] + fn part1() { + let challenge = day25::Day25 {}; + + //Complete the Challenge + let answer = challenge + .part1( + utils::get_input(challenge.get_day(), utils::InputType::Test1) + .unwrap() + .as_mut(), + ) + .unwrap() + .to_string(); + + assert_eq!(answer, "Ready"); + } + + #[test] + fn part2() { + let challenge = day25::Day25 {}; + + //Complete the Challenge + let answer = challenge + .part2( + utils::get_input(challenge.get_day(), utils::InputType::Test2) + .unwrap() + .as_mut(), + ) + .unwrap() + .to_string(); + + assert_eq!(answer, "Ready"); + } +} \ No newline at end of file diff --git a/src/solutions/mod.rs b/src/solutions/mod.rs index 31b31d6..54fd4e1 100644 --- a/src/solutions/mod.rs +++ b/src/solutions/mod.rs @@ -5,6 +5,24 @@ pub mod day04; pub mod day05; pub mod day06; pub mod day07; +pub mod day08; +pub mod day09; +pub mod day10; +pub mod day11; +pub mod day12; +pub mod day13; +pub mod day14; +pub mod day15; +pub mod day16; +pub mod day17; +pub mod day18; +pub mod day19; +pub mod day20; +pub mod day21; +pub mod day22; +pub mod day23; +pub mod day24; +pub mod day25; use crate::utils::{self, get_input}; use std::{error::Error, fmt::Display, time::SystemTime};