From fc1a39adf576f0f3f46092e9bb35fa050510fdeb Mon Sep 17 00:00:00 2001 From: Joey Pollack Date: Tue, 3 Dec 2024 14:23:13 -0500 Subject: [PATCH] Adjust the structure a bit and start on day 1 --- crates/day_1/src/day_1.rs | 39 ++++++++++++++++++++++----- crates/solver_base/src/solver_base.rs | 20 +++++++------- src/main.rs | 9 +++++-- 3 files changed, 48 insertions(+), 20 deletions(-) diff --git a/crates/day_1/src/day_1.rs b/crates/day_1/src/day_1.rs index c33e87e..1973a19 100644 --- a/crates/day_1/src/day_1.rs +++ b/crates/day_1/src/day_1.rs @@ -1,14 +1,39 @@ -use solver_base::solver_base; +use ::solver_base::solver_base::Solver; use utils::utils; -pub fn test_print() +pub struct Day1 { - println!("DAY 1 TEST PRINT"); - solver_base::print_test(); - let dir = utils::get_working_dir(); - let data = utils::load_data(&format!("{}/data/TESTING", dir)); - println!("DATA: {}", data); } +impl Day1 +{ + pub fn new() -> Day1 + { + Day1 { } + } +} + +impl Solver for Day1 +{ + fn print_test() + { + println!("DAY 1 TEST PRINT"); + // solver_base::print_test(); + + let dir = utils::get_working_dir(); + let data = utils::load_data(&format!("{}/data/TESTING", dir)); + println!("DATA: {}", data); + } + + fn init(self: &mut Self) + { + todo!() + } + + fn solve(self: &mut Self) -> String + { + todo!() + } +} \ No newline at end of file diff --git a/crates/solver_base/src/solver_base.rs b/crates/solver_base/src/solver_base.rs index d03c6c3..d0a41ea 100644 --- a/crates/solver_base/src/solver_base.rs +++ b/crates/solver_base/src/solver_base.rs @@ -1,15 +1,13 @@ pub trait Solver { - fn init(args: Vec); - fn solve(); -} - - - - -// OLD TEST FUNCTION -pub fn print_test() -{ - println!("SOLVER BASE PRINT TEST"); + + // TODO: Remove this function. Right now it just shows a "static" trait method. + fn print_test() + { + println!("SOLVER BASE PRINT TEST"); + } + + fn init(self: &mut Self); + fn solve(self: &mut Self) -> String; } diff --git a/src/main.rs b/src/main.rs index dd5da41..cbd8b2f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,7 +1,8 @@ use std::env; -use day_1; +use day_1::day_1::Day1; +use solver_base::solver_base::Solver; fn main() { @@ -13,6 +14,10 @@ fn main() } println!("Hello, world!"); - day_1::day_1::test_print(); + let mut day_1 = Day1::new(); + //day_1.print_test(); + Day1::print_test(); + day_1.init(); + day_1.solve(); }