You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
96 lines
2.1 KiB
Rust
96 lines
2.1 KiB
Rust
|
|
/******************************************************************************
|
|
* @file day_8.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 8 problems
|
|
******************************************************************************/
|
|
|
|
use ::solver_base::solver_base::{Solver, DataSet, RunMode};
|
|
use utils::utils;
|
|
|
|
pub struct Day8
|
|
{
|
|
data_set: DataSet,
|
|
run_mode: RunMode,
|
|
do_debug_prints: bool,
|
|
do_verbose_prints: bool,
|
|
|
|
pub final_result: i32,
|
|
}
|
|
|
|
//|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
// DAY 4 IMPL
|
|
//|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
impl Day8
|
|
{
|
|
pub fn new() -> Day8
|
|
{
|
|
Day8 {
|
|
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 Day8
|
|
{
|
|
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/day8_test_input", dir),
|
|
DataSet::TestAlt => panic!("Day 8: There is no TestAlt input file!"), //format!("{}/data/day2_test_input", dir),
|
|
DataSet::Full => format!("{}/data/day8_input", dir),
|
|
};
|
|
|
|
let _data = utils::load_data(&data_filename);
|
|
|
|
// TODO: Day8::init
|
|
|
|
}
|
|
|
|
fn solve(self: &mut Self) -> String
|
|
{
|
|
match self.run_mode
|
|
{
|
|
RunMode::FirstCase =>
|
|
{
|
|
self.solve_first_case()
|
|
},
|
|
|
|
RunMode::SecondCase =>
|
|
{
|
|
self.solve_second_case()
|
|
}
|
|
}
|
|
}
|
|
|
|
} |