From 12dda2e0a8bd77ef1b4438eccf6bf1b411425e85 Mon Sep 17 00:00:00 2001 From: mitchellhansen Date: Tue, 8 Dec 2020 22:53:06 -0800 Subject: [PATCH] problem 10 template --- src/main.rs | 26 +++++--------------------- src/problem10/lib.rs | 35 +++++++++++++++++++++++++++++++++++ src/problem10/mod.rs | 1 + 3 files changed, 41 insertions(+), 21 deletions(-) create mode 100644 src/problem10/lib.rs create mode 100644 src/problem10/mod.rs diff --git a/src/main.rs b/src/main.rs index 25a2180..e8e1e46 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,25 +2,9 @@ extern crate reqwest; extern crate tempfile; -use crate::problem1::lib::Problem1; -use crate::problem2::lib::Problem2; -use crate::problem3::lib::Problem3; -use crate::problem4::lib::Problem4; -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; +use crate::problem10::lib::Problem10; -mod problem1; -mod problem2; -mod problem3; -mod problem4; -mod problem5; -mod problem6; -mod problem7; -mod problem8; -mod problem9; +mod problem10; mod util; @@ -34,7 +18,7 @@ pub trait Problem { } fn main() { - let problem9 = Problem9::new(&util::get_problem(9)); - //problem9.run_part1(); - problem9.run_part2(); + let problem10 = Problem10::new(&util::get_problem(10)); + problem10.run_part1(); + problem10.run_part2(); } diff --git a/src/problem10/lib.rs b/src/problem10/lib.rs new file mode 100644 index 0000000..bca8b72 --- /dev/null +++ b/src/problem10/lib.rs @@ -0,0 +1,35 @@ + +use crate::Problem; + +pub struct Problem10 { + number_list: Vec, +} + +impl Problem10 {} + +impl Problem for Problem10 { + fn new(input: &String) -> Self { + Problem10 { + 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/problem10/mod.rs b/src/problem10/mod.rs new file mode 100644 index 0000000..965f28e --- /dev/null +++ b/src/problem10/mod.rs @@ -0,0 +1 @@ +pub mod lib;