diff --git a/src/main.rs b/src/main.rs index a623ad1..c112533 100644 --- a/src/main.rs +++ b/src/main.rs @@ -10,6 +10,7 @@ use crate::problem5::lib::Problem5; use crate::problem6::lib::Problem6; use crate::problem7::lib::Problem7; use crate::problem8::lib::Problem8; +use crate::problem9::lib::Problem9; mod problem1; mod problem2; @@ -19,6 +20,7 @@ mod problem5; mod problem6; mod problem7; mod problem8; +mod problem9; mod util; @@ -32,35 +34,7 @@ pub trait Problem { } fn main() { - // let problem1 = Problem1::new(&util::get_problem(1)); - // problem1.run_part1(); - // problem1.run_part2(); - - //let problem2 = Problem2::new(&util::get_problem(2)); - //problem2.run_part1(); - //problem2.run_part2(); - - // let problem3 = Problem3::new(&util::get_problem(3)); - // problem3.run_part1(); - // problem3.run_part2(); - - // let problem4 = Problem4::new(&util::get_problem(4)); - // problem4.run_part1(); - // problem4.run_part2(); - - // let problem5 = Problem5::new(&util::get_problem(5)); - // problem5.run_part1(); - // problem5.run_part2(); - - // let problem6 = Problem6::new(&util::get_problem(6)); - // problem6.run_part1(); - // problem6.run_part2(); - - /*let problem7 = Problem7::new(&util::get_problem(7)); - problem7.run_part1(); - problem7.run_part2();*/ - - let problem8 = Problem8::new(&util::get_problem(8)); - problem8.run_part1(); - problem8.run_part2(); + let problem9 = Problem9::new(&util::get_problem(9)); + problem9.run_part1(); + problem9.run_part2(); } diff --git a/src/problem9/lib.rs b/src/problem9/lib.rs new file mode 100644 index 0000000..513816b --- /dev/null +++ b/src/problem9/lib.rs @@ -0,0 +1,34 @@ + +use crate::Problem; + +pub struct Problem9 { + number_list: Vec, +} + +impl Problem9 {} + +impl Problem for Problem9 { + fn new(input: &String) -> Self { + Problem9 { + number_list: input + .split("\n") + .filter_map(|s| { + let s = s.trim(); + if !s.is_empty() { + Some(s.parse::().unwrap()) + } else { + None + } + }).collect(), + } + } + + fn run_part1(&self) { + + } + + fn run_part2(&self) { + + } +} + diff --git a/src/problem9/mod.rs b/src/problem9/mod.rs new file mode 100644 index 0000000..965f28e --- /dev/null +++ b/src/problem9/mod.rs @@ -0,0 +1 @@ +pub mod lib;