/****************************************************************************** * @file day_7.rs * @author Joey Pollack * @date 2024/12/05 (y/m/d) * @modified 2024/12/05 (y/m/d) * @copyright Joseph R Pollack * @brief Advent of Code 2024 day 7 problems ******************************************************************************/ use ::solver_base::solver_base::{Solver, DataSet, RunMode}; use utils::utils; pub struct Day7 { data_set: DataSet, run_mode: RunMode, do_debug_prints: bool, do_verbose_prints: bool, pub final_result: i32, } //||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| // DAY 4 IMPL //||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| impl Day7 { pub fn new() -> Day7 { Day7 { data_set: DataSet::Test, run_mode: RunMode::FirstCase, do_debug_prints: false, do_verbose_prints: false, final_result: 0 } } fn solve_first_case(self: &mut Self) -> String { self.final_result.to_string() } fn solve_second_case(self: &mut Self) -> String { self.final_result.to_string() } } //||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| // SOLVER TRAIT IMPL //||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| impl Solver for Day7 { fn print_test() { println!("DAY 7 TEST PRINT"); } fn init(self: &mut Self, data_set: DataSet, run_mode: RunMode, enable_debug_prints: bool, enable_verbose_prints: bool) { self.data_set = data_set; self.run_mode = run_mode; self.do_debug_prints = enable_debug_prints; self.do_verbose_prints = enable_verbose_prints; let dir = utils::get_working_dir(); let data_filename = match self.data_set { DataSet::Test => format!("{}/data/day7_test_input", dir), DataSet::TestAlt => panic!("Day 7: There is no TestAlt input file!"), //format!("{}/data/day2_test_input", dir), DataSet::Full => format!("{}/data/day7_input", dir), }; let _data = utils::load_data(&data_filename); // TODO: Day7::init } fn solve(self: &mut Self) -> String { match self.run_mode { RunMode::FirstCase => { self.solve_first_case() }, RunMode::SecondCase => { self.solve_second_case() } } } }