advent-of-code-2023/lib/src/lib.rs
Ty 07b9da7a08
Day 15
Today was chill, i loved it
2023-12-14 23:16:08 -07:00

79 lines
1.7 KiB
Rust

use std::{collections::HashMap, num::NonZeroUsize};
use clru::CLruCache;
use day1::Day1;
use day10::Day10;
use day11::Day11;
use day12::Day12;
use day13::Day13;
use day14::Day14;
use day15::Day15;
use day2::Day2;
use day3::Day3;
use day4::Day4;
use day5::Day5;
use day6::Day6;
use day7::Day7;
use day8::Day8;
use day9::Day9;
use utils::Day;
pub mod fetcher;
pub mod utils;
pub mod day1;
pub mod day10;
pub mod day11;
pub mod day12;
pub mod day13;
pub mod day14;
pub mod day15;
pub mod day2;
pub mod day3;
pub mod day4;
pub mod day5;
pub mod day6;
pub mod day7;
pub mod day8;
pub mod day9;
pub fn get_day(day: u8, input: String) -> Box<dyn Day> {
match day {
1 => Box::new(Day1 { input }),
2 => Box::new(Day2 {
input,
games: vec![],
}),
3 => Box::new(Day3 { input }),
4 => Box::new(Day4 {
input,
acc: 0usize,
cards: HashMap::new(),
}),
5 => Box::new(Day5 { input }),
6 => Box::new(Day6 { input }),
7 => Box::new(Day7 {
input,
hands: vec![],
}),
8 => Box::new(Day8 { input }),
9 => Box::new(Day9 { input }),
10 => Box::new(Day10 {
input,
parsed: vec![],
}),
11 => Box::new(Day11 {
input,
rows_expanded: vec![],
columns_expanded: vec![],
}),
12 => Box::new(Day12 {
input,
cache: CLruCache::new(NonZeroUsize::new(10000).unwrap()),
}),
13 => Box::new(Day13 { input }),
14 => Box::new(Day14 { input }),
15 => Box::new(Day15 { input }),
_ => panic!("Invalid day #"),
}
}