Completed template for advent of code XXXX
Some checks failed
Continuous integration / Check (push) Successful in 50s
Continuous integration / Test Suite (push) Successful in 52s
Continuous integration / Rustfmt (push) Failing after 38s
Continuous integration / build (push) Successful in 51s

This commit is contained in:
Luke Else 2024-11-22 10:59:40 +00:00
parent 0b35b8f623
commit 6646e1d9d0
3 changed files with 17 additions and 13 deletions

View File

@ -1,13 +0,0 @@
for day in range(1, 26):
boilerplate = open(".\\src\\solutions\\dayxx.rs", "r").read()
boilerplate = boilerplate.replace("0", str(day))
boilerplate = boilerplate.replace("XX", f"{day:02d}")
new_code = open(f".\\src\\solutions\\day{day:02d}.rs", "w")
new_code.write(boilerplate)
f = open(f".\\input\\day{day:02d}", "x")
f = open(f".\\input\\day{day:02d}_test1", "x")
f = open(f".\\input\\day{day:02d}_test2", "x")

View File

@ -27,11 +27,26 @@ pub mod day25;
use crate::utils::{self, get_input};
use std::{error::Error, fmt::Display, time::SystemTime};
// Solution class running your answers for part 1 and 2.
pub trait Solution: Send + Sync {
// Insert your solution for part one in here,
// returning it as a:
///```
/// OK(Box::new(ans))
/// ```
fn part1(&self, input: &mut Vec<String>) -> Result<Box<dyn Display>, Box<dyn Error>>;
// Insert your solution for part two in here,
// returning it as a:
///```
/// OK(Box::new(ans))
/// ```
fn part2(&self, input: &mut Vec<String>) -> Result<Box<dyn Display>, Box<dyn Error>>;
// Returns the day that is currently being run
fn get_day(&self) -> u8;
// Runs part 1 and 2 for each day synchronously (One after the other)
fn run(&self) -> Result<Run, Box<dyn std::error::Error>> {
let start_time = SystemTime::now();

View File

@ -33,3 +33,5 @@ pub fn get_input(day: u8, input: InputType) -> Result<Vec<String>, Box<dyn Error
Ok(data)
}
/* Insert any utils you create in this file here */