Skip to content

Rust library to batch-execute, time, and verify solutions to Advent of Code puzzles

License

Notifications You must be signed in to change notification settings

newo-2001/jikan

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Jikan (時間) is a Rust library to batch-execute, time, and verify solutions to Advent of Code puzzles.

Code Example

struct Manifests;
impl ManifestProvider for Manifests {
    fn get_manifest(day: Day) -> Result<DayManifest, Box<dyn Error>> {
        let path = format!("data/{}/day_{:02}.yaml", day.year, day.day);
        let file = File::open(&path)?;
        let manifest = serde_yml::from_reader(file)?;
        Ok(manifest)
    }
}

fn main() -> Result<(), Box<dyn Error>> {
    let options = jikan::ExecutionOptions::from_args();

    let solvers: HashMap<Puzzle, Solver> = [
        (Puzzle { year: 2023, day: 1, part: 1 }, solvers_2023::day_01::solve_part_1 as Solver)
    ].into_iter().collect();

    jikan::execute::<Manifests, _, _>(options, &solvers);

    Ok(())
}

The inputs, and solutions can be parsed using any serde compatible deserializer. Here is an example YAML structure

input: |-
  1abc2
  pqr3stu8vwx
  a1b2c3d4e5f
  treb7uchet
parts:
  - solution: 142

About

Rust library to batch-execute, time, and verify solutions to Advent of Code puzzles

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages