2021-12-05 13:02:50 +00:00
|
|
|
use std::time::{Duration, Instant};
|
|
|
|
|
|
|
|
use color_eyre::Result;
|
2021-12-04 13:38:34 +00:00
|
|
|
|
2021-12-01 11:50:38 +00:00
|
|
|
mod day_01;
|
2021-12-02 11:47:38 +00:00
|
|
|
mod day_02;
|
2021-12-03 11:18:23 +00:00
|
|
|
mod day_03;
|
2021-12-04 13:15:12 +00:00
|
|
|
mod day_04;
|
2021-12-05 13:02:50 +00:00
|
|
|
mod day_05;
|
2021-12-06 11:16:13 +00:00
|
|
|
mod day_06;
|
2021-12-07 13:24:37 +00:00
|
|
|
mod day_07;
|
2021-12-08 14:44:13 +00:00
|
|
|
mod day_08;
|
2021-12-09 12:12:49 +00:00
|
|
|
mod day_09;
|
2021-12-10 12:37:49 +00:00
|
|
|
mod day_10;
|
2021-12-14 14:01:16 +00:00
|
|
|
mod day_14;
|
2021-12-01 11:50:38 +00:00
|
|
|
|
2021-12-05 13:02:50 +00:00
|
|
|
fn main() -> Result<()> {
|
2021-12-01 11:50:38 +00:00
|
|
|
color_eyre::install()?;
|
2021-12-05 13:02:50 +00:00
|
|
|
println!("Advent of Code 2021\n");
|
2021-12-01 11:50:38 +00:00
|
|
|
|
2021-12-05 13:02:50 +00:00
|
|
|
let mut runtimes = vec![];
|
|
|
|
let days: Vec<fn() -> Result<()>> = vec![
|
|
|
|
day_01::solve,
|
|
|
|
day_02::solve,
|
|
|
|
day_03::solve,
|
|
|
|
day_04::solve,
|
|
|
|
day_05::solve,
|
2021-12-06 11:16:13 +00:00
|
|
|
day_06::solve,
|
2021-12-07 13:24:37 +00:00
|
|
|
day_07::solve,
|
2021-12-08 14:44:13 +00:00
|
|
|
day_08::solve,
|
2021-12-09 12:12:49 +00:00
|
|
|
day_09::solve,
|
2021-12-10 12:37:49 +00:00
|
|
|
day_10::solve,
|
2021-12-14 14:01:16 +00:00
|
|
|
day_14::solve,
|
2021-12-05 13:02:50 +00:00
|
|
|
];
|
2021-12-04 13:38:34 +00:00
|
|
|
|
2021-12-05 13:02:50 +00:00
|
|
|
for day in days {
|
|
|
|
let start = Instant::now();
|
|
|
|
day()?;
|
|
|
|
let runtime = Instant::now() - start;
|
|
|
|
runtimes.push(runtime);
|
|
|
|
println!("- Runtime: {:#?}\n", runtime);
|
|
|
|
}
|
2021-12-01 11:50:38 +00:00
|
|
|
|
2021-12-05 13:02:50 +00:00
|
|
|
println!(
|
|
|
|
"Total runtime: {:#?}",
|
|
|
|
runtimes.into_iter().sum::<Duration>()
|
|
|
|
);
|
2021-12-04 13:38:34 +00:00
|
|
|
|
2021-12-01 11:50:38 +00:00
|
|
|
Ok(())
|
|
|
|
}
|