adventofcode/2022/src/main.rs

75 lines
1.6 KiB
Rust
Raw Normal View History

use std::env;
use std::io;
mod utils;
const LATEST: u8 = 3;
mod day01;
mod day02;
mod day03;
// mod day04;
// mod day05;
// mod day06;
// mod day07;
// mod day08;
// mod day09;
// mod day10;
// mod day11;
// mod day12;
// mod day13;
// mod day14;
// mod day15;
// mod day16;
// mod day17;
// mod day18;
// mod day19;
// mod day20;
// mod day21;
// mod day22;
// mod day23;
// mod day24;
// mod day25;
fn main() -> io::Result<()> {
let day = determine_day(LATEST);
match day {
1 => day01::execute(),
2 => day02::execute(),
3 => day03::execute(),
// 4 => day04::execute(),
// 5 => day05::execute(),
// 6 => day06::execute(),
// 7 => day07::execute(),
// 8 => day08::execute(),
// 9 => day09::execute(),
// 10 => day10::execute(),
// 11 => day11::execute(),
// 12 => day12::execute(),
// 13 => day13::execute(),
// 14 => day14::execute(),
// 15 => day15::execute(),
// 16 => day16::execute(),
// 17 => day17::execute(),
// 18 => day18::execute(),
// 19 => day19::execute(),
// 20 => day20::execute(),
// 21 => day21::execute(),
// 22 => day22::execute(),
// 23 => day23::execute(),
// 24 => day24::execute(),
// 25 => day25::execute(),
_ => panic!("Couldn't execute day {day}")
}
}
fn determine_day(latest: u8) -> u8 {
let mut day = latest;
for arg in env::args() {
if let Ok(x) = arg.parse::<u8>() {
day = x;
break;
}
}
return day;
}