Completed template for advent of code XXXX
This commit is contained in:
		
							
								
								
									
										13
									
								
								create.py
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								create.py
									
									
									
									
									
								
							@@ -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")
 | 
			
		||||
@@ -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();
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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 */
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user