pub mod days; extern crate scan_fmt; use std::time::Instant; fn main() { if std::env::args().len() > 1 { if let Some(day) = std::env::args().nth(1) { match day.as_str() { "all" => all_days(), "1" => days::d01::solve(), "2" => days::d02::solve(), "3" => days::d03::solve(), "4" => days::d04::solve(), "5" => days::d05::solve(), "6" => days::d06::solve(), "7" => days::d07::solve(), "8" => days::d08::solve(), "9" => days::d09::solve(), "10" => days::d10::solve(), "11" => days::d11::solve(), "12" => days::d12::solve(), "13" => days::d13::solve(), "14" => days::d14::solve(), "15" => days::d15::solve(), "16" => days::d16::solve(), "17" => days::d17::solve(), "18" => days::d18::solve(), "19" => days::d19::solve(), "20" => days::d20::solve(), "21" => days::d21::solve(), "22" => days::d22::solve(), "23" => days::d23::solve(), "24" => days::d24::solve(), "25" => days::d25::solve(), _ => println!("Day not implemented"), } } } else { all_days(); } } #[allow(unused)] fn all_days() { let start = Instant::now(); let mut time = start.clone(); println!("\nDay 1"); days::d01::solve(); time = _print_elapsed(time); println!("\nDay 2"); days::d02::solve(); time = _print_elapsed(time); println!("\nDay 3"); days::d03::solve(); time = _print_elapsed(time); println!("\nDay 4"); days::d04::solve(); time = _print_elapsed(time); println!("\nDay 5"); days::d05::solve(); time = _print_elapsed(time); println!("\nDay 6"); days::d06::solve(); time = _print_elapsed(time); println!("\nDay 7"); days::d07::solve(); time = _print_elapsed(time); println!("\nDay 8"); days::d08::solve(); time = _print_elapsed(time); println!("\nDay 9"); days::d09::solve(); time = _print_elapsed(time); println!("\nDay 10"); days::d10::solve(); time = _print_elapsed(time); println!("\nDay 11"); days::d11::solve(); time = _print_elapsed(time); println!("\nDay 12"); days::d12::solve(); time = _print_elapsed(time); println!("\nDay 13"); days::d13::solve(); time = _print_elapsed(time); println!("\nDay 14"); days::d14::solve(); time = _print_elapsed(time); println!("\nDay 15"); days::d15::solve(); time = _print_elapsed(time); println!("\nDay 16"); days::d16::solve(); time = _print_elapsed(time); println!("\nDay 17"); days::d17::solve(); time = _print_elapsed(time); println!("\nDay 18"); days::d18::solve(); time = _print_elapsed(time); println!("\nDay 19"); days::d19::solve(); time = _print_elapsed(time); println!("\nDay 20"); days::d20::solve(); time = _print_elapsed(time); println!("\nDay 21"); days::d21::solve(); time = _print_elapsed(time); println!("\nDay 22"); days::d22::solve(); time = _print_elapsed(time); println!("\nDay 23"); days::d23::solve(); time = _print_elapsed(time); println!("\nDay 24"); days::d24::solve(); time = _print_elapsed(time); println!("\nDay 25"); days::d25::solve(); _print_elapsed(time); println!("\nTotal elapsed: {}ms", start.elapsed().as_millis()) } fn _print_elapsed(time: Instant) -> Instant { println!( " Elapsed: {}.{}ms", time.elapsed().as_millis(), time.elapsed().as_micros() % 1000 ); Instant::now() }