2024
This commit is contained in:
parent
294c0a8e62
commit
e1ca0d5f61
76 changed files with 4607 additions and 204 deletions
19
.direnv/bin/nix-direnv-reload
Executable file
19
.direnv/bin/nix-direnv-reload
Executable file
|
|
@ -0,0 +1,19 @@
|
|||
#!/usr/bin/env bash
|
||||
set -e
|
||||
if [[ ! -d "/home/spectre/code/aocrust" ]]; then
|
||||
echo "Cannot find source directory; Did you move it?"
|
||||
echo "(Looking for "/home/spectre/code/aocrust")"
|
||||
echo 'Cannot force reload with this script - use "direnv reload" manually and then try again'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# rebuild the cache forcefully
|
||||
_nix_direnv_force_reload=1 direnv exec "/home/spectre/code/aocrust" true
|
||||
|
||||
# Update the mtime for .envrc.
|
||||
# This will cause direnv to reload again - but without re-building.
|
||||
touch "/home/spectre/code/aocrust/.envrc"
|
||||
|
||||
# Also update the timestamp of whatever profile_rc we have.
|
||||
# This makes sure that we know we are up to date.
|
||||
touch -r "/home/spectre/code/aocrust/.envrc" "/home/spectre/code/aocrust/.direnv"/*.rc
|
||||
1
.direnv/flake-inputs/1xqxr1v6zrnvh22084127343pykvrjbi-source
Symbolic link
1
.direnv/flake-inputs/1xqxr1v6zrnvh22084127343pykvrjbi-source
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
/nix/store/1xqxr1v6zrnvh22084127343pykvrjbi-source
|
||||
1
.direnv/flake-inputs/4w4b4mxfhdc9lf3rsf4qqa9z8xnijbxl-source
Symbolic link
1
.direnv/flake-inputs/4w4b4mxfhdc9lf3rsf4qqa9z8xnijbxl-source
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
/nix/store/4w4b4mxfhdc9lf3rsf4qqa9z8xnijbxl-source
|
||||
1
.direnv/flake-inputs/61gw1axgxrvx0bnxv2dla6zhkgwv45zr-source
Symbolic link
1
.direnv/flake-inputs/61gw1axgxrvx0bnxv2dla6zhkgwv45zr-source
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
/nix/store/61gw1axgxrvx0bnxv2dla6zhkgwv45zr-source
|
||||
1
.direnv/flake-inputs/yj1wxm9hh8610iyzqnz75kvs6xl8j3my-source
Symbolic link
1
.direnv/flake-inputs/yj1wxm9hh8610iyzqnz75kvs6xl8j3my-source
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
/nix/store/yj1wxm9hh8610iyzqnz75kvs6xl8j3my-source
|
||||
1
.direnv/flake-inputs/z394vfm4xw2sd40c4qm428qhi4rmpn1s-source
Symbolic link
1
.direnv/flake-inputs/z394vfm4xw2sd40c4qm428qhi4rmpn1s-source
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
/nix/store/z394vfm4xw2sd40c4qm428qhi4rmpn1s-source
|
||||
1
.direnv/flake-profile-a5d5b61aa8a61b7d9d765e1daf971a9a578f1cfa
Symbolic link
1
.direnv/flake-profile-a5d5b61aa8a61b7d9d765e1daf971a9a578f1cfa
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
/nix/store/9h3sip52v44rmqykfjyirn4ih3sislxw-nix-shell-env
|
||||
1916
.direnv/flake-profile-a5d5b61aa8a61b7d9d765e1daf971a9a578f1cfa.rc
Normal file
1916
.direnv/flake-profile-a5d5b61aa8a61b7d9d765e1daf971a9a578f1cfa.rc
Normal file
File diff suppressed because it is too large
Load diff
1
.envrc
Normal file
1
.envrc
Normal file
|
|
@ -0,0 +1 @@
|
|||
use flake
|
||||
8
.idea/.gitignore
generated
vendored
8
.idea/.gitignore
generated
vendored
|
|
@ -1,8 +0,0 @@
|
|||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
15
.idea/AdventOfCode.iml
generated
15
.idea/AdventOfCode.iml
generated
|
|
@ -1,15 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="EMPTY_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/aoc2023/src" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/shared/src" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/examples" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/tests" isTestSource="true" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
8
.idea/modules.xml
generated
8
.idea/modules.xml
generated
|
|
@ -1,8 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/AdventOfCode.iml" filepath="$PROJECT_DIR$/.idea/AdventOfCode.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
6
.idea/vcs.xml
generated
6
.idea/vcs.xml
generated
|
|
@ -1,6 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
1608
Cargo.lock
generated
1608
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
|
@ -6,8 +6,10 @@ edition = "2021"
|
|||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[workspace]
|
||||
members = ["shared", "aoc2023"]
|
||||
members = ["shared", "aoc2023", "aoc2024"]
|
||||
|
||||
[dependencies]
|
||||
shared = { path = "shared" }
|
||||
aoc2023 = { path = "aoc2023" }
|
||||
aoc2024 = { path = "aoc2024" }
|
||||
reqwest = { version = "0.12.9", features = ["cookies", "blocking"] }
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
use shared::{Answer, load_test, Solution};
|
||||
use shared::{Answer, Solution};
|
||||
use regex::{Regex};
|
||||
|
||||
pub struct Day01;
|
||||
|
|
|
|||
|
|
@ -1,58 +1,118 @@
|
|||
use shared::Solution;
|
||||
use crate::day01::Day01;
|
||||
use crate::day02::Day02;
|
||||
use crate::day03::Day03;
|
||||
use crate::day04::Day04;
|
||||
use crate::day05::Day05;
|
||||
use crate::day06::Day06;
|
||||
use crate::day07::Day07;
|
||||
use crate::day08::Day08;
|
||||
use crate::day09::Day09;
|
||||
use crate::day10::Day10;
|
||||
use crate::day11::Day11;
|
||||
use crate::day12::Day12;
|
||||
use crate::day13::Day13;
|
||||
use crate::day14::Day14;
|
||||
use crate::day15::Day15;
|
||||
use crate::day16::Day16;
|
||||
use crate::day17::Day17;
|
||||
use crate::day18::Day18;
|
||||
use crate::day19::Day19;
|
||||
use crate::day20::Day20;
|
||||
use crate::day21::Day21;
|
||||
use crate::day22::Day22;
|
||||
use crate::day23::Day23;
|
||||
use crate::day24::Day24;
|
||||
use crate::day25::Day25;
|
||||
use shared::{Solution, Answer};
|
||||
|
||||
pub mod day01;
|
||||
pub mod day02;
|
||||
pub mod day03;
|
||||
pub mod day04;
|
||||
pub mod day05;
|
||||
pub mod day06;
|
||||
pub mod day07;
|
||||
pub mod day08;
|
||||
pub mod day09;
|
||||
pub mod day10;
|
||||
pub use crate::day01::Day01;
|
||||
pub use crate::day02::Day02;
|
||||
pub use crate::day03::Day03;
|
||||
pub use crate::day04::Day04;
|
||||
pub use crate::day05::Day05;
|
||||
pub use crate::day06::Day06;
|
||||
pub use crate::day07::Day07;
|
||||
pub use crate::day08::Day08;
|
||||
pub use crate::day09::Day09;
|
||||
pub use crate::day10::Day10;
|
||||
pub use crate::day11::Day11;
|
||||
pub use crate::day12::Day12;
|
||||
pub use crate::day13::Day13;
|
||||
pub use crate::day14::Day14;
|
||||
pub use crate::day15::Day15;
|
||||
pub use crate::day16::Day16;
|
||||
pub use crate::day17::Day17;
|
||||
pub use crate::day18::Day18;
|
||||
pub use crate::day19::Day19;
|
||||
pub use crate::day20::Day20;
|
||||
pub use crate::day21::Day21;
|
||||
pub use crate::day22::Day22;
|
||||
pub use crate::day23::Day23;
|
||||
pub use crate::day24::Day24;
|
||||
pub use crate::day25::Day25;
|
||||
|
||||
pub mod day11;
|
||||
pub fn solution(input: &str, day: usize, part: usize) -> Option<Answer> {
|
||||
match part {
|
||||
1 => match day {
|
||||
1 => Some(Day01.part_1(input)),
|
||||
2 => Some(Day02.part_1(input)),
|
||||
3 => Some(Day03.part_1(input)),
|
||||
4 => Some(Day04.part_1(input)),
|
||||
5 => Some(Day05.part_1(input)),
|
||||
6 => Some(Day06.part_1(input)),
|
||||
7 => Some(Day07.part_1(input)),
|
||||
8 => Some(Day08.part_1(input)),
|
||||
9 => Some(Day09.part_1(input)),
|
||||
10 => Some(Day10.part_1(input)),
|
||||
11 => Some(Day11.part_1(input)),
|
||||
12 => Some(Day12.part_1(input)),
|
||||
13 => Some(Day13.part_1(input)),
|
||||
14 => Some(Day14.part_1(input)),
|
||||
15 => Some(Day15.part_1(input)),
|
||||
16 => Some(Day16.part_1(input)),
|
||||
17 => Some(Day17.part_1(input)),
|
||||
18 => Some(Day18.part_1(input)),
|
||||
19 => Some(Day19.part_1(input)),
|
||||
20 => Some(Day20.part_1(input)),
|
||||
21 => Some(Day21.part_1(input)),
|
||||
22 => Some(Day22.part_1(input)),
|
||||
23 => Some(Day23.part_1(input)),
|
||||
24 => Some(Day24.part_1(input)),
|
||||
25 => Some(Day25.part_1(input)),
|
||||
_ => None
|
||||
},
|
||||
2 => match day {
|
||||
1 => Some(Day01.part_2(input)),
|
||||
2 => Some(Day02.part_2(input)),
|
||||
3 => Some(Day03.part_2(input)),
|
||||
4 => Some(Day04.part_2(input)),
|
||||
5 => Some(Day05.part_2(input)),
|
||||
6 => Some(Day06.part_2(input)),
|
||||
7 => Some(Day07.part_2(input)),
|
||||
8 => Some(Day08.part_2(input)),
|
||||
9 => Some(Day09.part_2(input)),
|
||||
10 => Some(Day10.part_2(input)),
|
||||
11 => Some(Day11.part_2(input)),
|
||||
12 => Some(Day12.part_2(input)),
|
||||
13 => Some(Day13.part_2(input)),
|
||||
14 => Some(Day14.part_2(input)),
|
||||
15 => Some(Day15.part_2(input)),
|
||||
16 => Some(Day16.part_2(input)),
|
||||
17 => Some(Day17.part_2(input)),
|
||||
18 => Some(Day18.part_2(input)),
|
||||
19 => Some(Day19.part_2(input)),
|
||||
20 => Some(Day20.part_2(input)),
|
||||
21 => Some(Day21.part_2(input)),
|
||||
22 => Some(Day22.part_2(input)),
|
||||
23 => Some(Day23.part_2(input)),
|
||||
24 => Some(Day24.part_2(input)),
|
||||
25 => Some(Day25.part_2(input)),
|
||||
_ => None
|
||||
},
|
||||
_ => None
|
||||
}
|
||||
}
|
||||
|
||||
pub mod day12;
|
||||
|
||||
pub mod day13;
|
||||
pub mod day14;
|
||||
pub mod day15;
|
||||
pub mod day16;
|
||||
pub mod day17;
|
||||
pub mod day18;
|
||||
pub mod day19;
|
||||
pub mod day20;
|
||||
pub mod day21;
|
||||
pub mod day22;
|
||||
pub mod day23;
|
||||
pub mod day24;
|
||||
pub mod day25;
|
||||
mod day01;
|
||||
mod day02;
|
||||
mod day03;
|
||||
mod day04;
|
||||
mod day05;
|
||||
mod day06;
|
||||
mod day07;
|
||||
mod day08;
|
||||
mod day09;
|
||||
mod day10;
|
||||
mod day11;
|
||||
mod day12;
|
||||
mod day13;
|
||||
mod day14;
|
||||
mod day15;
|
||||
mod day16;
|
||||
mod day17;
|
||||
mod day18;
|
||||
mod day19;
|
||||
mod day20;
|
||||
mod day21;
|
||||
mod day22;
|
||||
mod day23;
|
||||
mod day24;
|
||||
mod day25;
|
||||
|
||||
#[test]
|
||||
fn examples() {
|
||||
|
|
|
|||
10
aoc2024/Cargo.toml
Normal file
10
aoc2024/Cargo.toml
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
[package]
|
||||
name = "aoc2024"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
shared = { path = "../shared" }
|
||||
regex = "1.10.2"
|
||||
substring = "1.4.5"
|
||||
itertools = "0.12.0"
|
||||
13
aoc2024/src/day01.rs
Normal file
13
aoc2024/src/day01.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
use shared::{Solution, Answer};
|
||||
|
||||
pub struct Day01;
|
||||
|
||||
impl Solution for Day01 {
|
||||
fn part_1(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
|
||||
fn part_2(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
}
|
||||
13
aoc2024/src/day02.rs
Normal file
13
aoc2024/src/day02.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
use shared::{Solution, Answer};
|
||||
|
||||
pub struct Day02;
|
||||
|
||||
impl Solution for Day02 {
|
||||
fn part_1(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
|
||||
fn part_2(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
}
|
||||
13
aoc2024/src/day03.rs
Normal file
13
aoc2024/src/day03.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
use shared::{Solution, Answer};
|
||||
|
||||
pub struct Day03;
|
||||
|
||||
impl Solution for Day03 {
|
||||
fn part_1(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
|
||||
fn part_2(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
}
|
||||
13
aoc2024/src/day04.rs
Normal file
13
aoc2024/src/day04.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
use shared::{Solution, Answer};
|
||||
|
||||
pub struct Day04;
|
||||
|
||||
impl Solution for Day04 {
|
||||
fn part_1(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
|
||||
fn part_2(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
}
|
||||
13
aoc2024/src/day05.rs
Normal file
13
aoc2024/src/day05.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
use shared::{Solution, Answer};
|
||||
|
||||
pub struct Day05;
|
||||
|
||||
impl Solution for Day05 {
|
||||
fn part_1(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
|
||||
fn part_2(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
}
|
||||
13
aoc2024/src/day06.rs
Normal file
13
aoc2024/src/day06.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
use shared::{Solution, Answer};
|
||||
|
||||
pub struct Day06;
|
||||
|
||||
impl Solution for Day06 {
|
||||
fn part_1(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
|
||||
fn part_2(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
}
|
||||
13
aoc2024/src/day07.rs
Normal file
13
aoc2024/src/day07.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
use shared::{Solution, Answer};
|
||||
|
||||
pub struct Day07;
|
||||
|
||||
impl Solution for Day07 {
|
||||
fn part_1(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
|
||||
fn part_2(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
}
|
||||
13
aoc2024/src/day08.rs
Normal file
13
aoc2024/src/day08.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
use shared::{Solution, Answer};
|
||||
|
||||
pub struct Day08;
|
||||
|
||||
impl Solution for Day08 {
|
||||
fn part_1(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
|
||||
fn part_2(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
}
|
||||
13
aoc2024/src/day09.rs
Normal file
13
aoc2024/src/day09.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
use shared::{Solution, Answer};
|
||||
|
||||
pub struct Day09;
|
||||
|
||||
impl Solution for Day09 {
|
||||
fn part_1(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
|
||||
fn part_2(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
}
|
||||
13
aoc2024/src/day10.rs
Normal file
13
aoc2024/src/day10.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
use shared::{Solution, Answer};
|
||||
|
||||
pub struct Day10;
|
||||
|
||||
impl Solution for Day10 {
|
||||
fn part_1(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
|
||||
fn part_2(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
}
|
||||
13
aoc2024/src/day11.rs
Normal file
13
aoc2024/src/day11.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
use shared::{Solution, Answer};
|
||||
|
||||
pub struct Day11;
|
||||
|
||||
impl Solution for Day11 {
|
||||
fn part_1(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
|
||||
fn part_2(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
}
|
||||
13
aoc2024/src/day12.rs
Normal file
13
aoc2024/src/day12.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
use shared::{Solution, Answer};
|
||||
|
||||
pub struct Day12;
|
||||
|
||||
impl Solution for Day12 {
|
||||
fn part_1(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
|
||||
fn part_2(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
}
|
||||
13
aoc2024/src/day13.rs
Normal file
13
aoc2024/src/day13.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
use shared::{Solution, Answer};
|
||||
|
||||
pub struct Day13;
|
||||
|
||||
impl Solution for Day13 {
|
||||
fn part_1(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
|
||||
fn part_2(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
}
|
||||
13
aoc2024/src/day14.rs
Normal file
13
aoc2024/src/day14.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
use shared::{Solution, Answer};
|
||||
|
||||
pub struct Day14;
|
||||
|
||||
impl Solution for Day14 {
|
||||
fn part_1(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
|
||||
fn part_2(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
}
|
||||
13
aoc2024/src/day15.rs
Normal file
13
aoc2024/src/day15.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
use shared::{Solution, Answer};
|
||||
|
||||
pub struct Day15;
|
||||
|
||||
impl Solution for Day15 {
|
||||
fn part_1(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
|
||||
fn part_2(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
}
|
||||
13
aoc2024/src/day16.rs
Normal file
13
aoc2024/src/day16.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
use shared::{Solution, Answer};
|
||||
|
||||
pub struct Day16;
|
||||
|
||||
impl Solution for Day16 {
|
||||
fn part_1(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
|
||||
fn part_2(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
}
|
||||
13
aoc2024/src/day17.rs
Normal file
13
aoc2024/src/day17.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
use shared::{Solution, Answer};
|
||||
|
||||
pub struct Day17;
|
||||
|
||||
impl Solution for Day17 {
|
||||
fn part_1(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
|
||||
fn part_2(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
}
|
||||
13
aoc2024/src/day18.rs
Normal file
13
aoc2024/src/day18.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
use shared::{Solution, Answer};
|
||||
|
||||
pub struct Day18;
|
||||
|
||||
impl Solution for Day18 {
|
||||
fn part_1(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
|
||||
fn part_2(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
}
|
||||
13
aoc2024/src/day19.rs
Normal file
13
aoc2024/src/day19.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
use shared::{Solution, Answer};
|
||||
|
||||
pub struct Day19;
|
||||
|
||||
impl Solution for Day19 {
|
||||
fn part_1(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
|
||||
fn part_2(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
}
|
||||
13
aoc2024/src/day20.rs
Normal file
13
aoc2024/src/day20.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
use shared::{Solution, Answer};
|
||||
|
||||
pub struct Day20;
|
||||
|
||||
impl Solution for Day20 {
|
||||
fn part_1(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
|
||||
fn part_2(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
}
|
||||
13
aoc2024/src/day21.rs
Normal file
13
aoc2024/src/day21.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
use shared::{Solution, Answer};
|
||||
|
||||
pub struct Day21;
|
||||
|
||||
impl Solution for Day21 {
|
||||
fn part_1(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
|
||||
fn part_2(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
}
|
||||
13
aoc2024/src/day22.rs
Normal file
13
aoc2024/src/day22.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
use shared::{Solution, Answer};
|
||||
|
||||
pub struct Day22;
|
||||
|
||||
impl Solution for Day22 {
|
||||
fn part_1(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
|
||||
fn part_2(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
}
|
||||
13
aoc2024/src/day23.rs
Normal file
13
aoc2024/src/day23.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
use shared::{Solution, Answer};
|
||||
|
||||
pub struct Day23;
|
||||
|
||||
impl Solution for Day23 {
|
||||
fn part_1(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
|
||||
fn part_2(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
}
|
||||
13
aoc2024/src/day24.rs
Normal file
13
aoc2024/src/day24.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
use shared::{Solution, Answer};
|
||||
|
||||
pub struct Day24;
|
||||
|
||||
impl Solution for Day24 {
|
||||
fn part_1(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
|
||||
fn part_2(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
}
|
||||
13
aoc2024/src/day25.rs
Normal file
13
aoc2024/src/day25.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
use shared::{Solution, Answer};
|
||||
|
||||
pub struct Day25;
|
||||
|
||||
impl Solution for Day25 {
|
||||
fn part_1(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
|
||||
fn part_2(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
}
|
||||
120
aoc2024/src/lib.rs
Normal file
120
aoc2024/src/lib.rs
Normal file
|
|
@ -0,0 +1,120 @@
|
|||
use shared::{Solution, Answer};
|
||||
|
||||
pub use crate::day01::Day01;
|
||||
pub use crate::day02::Day02;
|
||||
pub use crate::day03::Day03;
|
||||
pub use crate::day04::Day04;
|
||||
pub use crate::day05::Day05;
|
||||
pub use crate::day06::Day06;
|
||||
pub use crate::day07::Day07;
|
||||
pub use crate::day08::Day08;
|
||||
pub use crate::day09::Day09;
|
||||
pub use crate::day10::Day10;
|
||||
pub use crate::day11::Day11;
|
||||
pub use crate::day12::Day12;
|
||||
pub use crate::day13::Day13;
|
||||
pub use crate::day14::Day14;
|
||||
pub use crate::day15::Day15;
|
||||
pub use crate::day16::Day16;
|
||||
pub use crate::day17::Day17;
|
||||
pub use crate::day18::Day18;
|
||||
pub use crate::day19::Day19;
|
||||
pub use crate::day20::Day20;
|
||||
pub use crate::day21::Day21;
|
||||
pub use crate::day22::Day22;
|
||||
pub use crate::day23::Day23;
|
||||
pub use crate::day24::Day24;
|
||||
pub use crate::day25::Day25;
|
||||
|
||||
pub fn solution(input: &str, day: usize, part: usize) -> Option<Answer> {
|
||||
match part {
|
||||
1 => match day {
|
||||
1 => Some(Day01.part_1(input)),
|
||||
2 => Some(Day02.part_1(input)),
|
||||
3 => Some(Day03.part_1(input)),
|
||||
4 => Some(Day04.part_1(input)),
|
||||
5 => Some(Day05.part_1(input)),
|
||||
6 => Some(Day06.part_1(input)),
|
||||
7 => Some(Day07.part_1(input)),
|
||||
8 => Some(Day08.part_1(input)),
|
||||
9 => Some(Day09.part_1(input)),
|
||||
10 => Some(Day10.part_1(input)),
|
||||
11 => Some(Day11.part_1(input)),
|
||||
12 => Some(Day12.part_1(input)),
|
||||
13 => Some(Day13.part_1(input)),
|
||||
14 => Some(Day14.part_1(input)),
|
||||
15 => Some(Day15.part_1(input)),
|
||||
16 => Some(Day16.part_1(input)),
|
||||
17 => Some(Day17.part_1(input)),
|
||||
18 => Some(Day18.part_1(input)),
|
||||
19 => Some(Day19.part_1(input)),
|
||||
20 => Some(Day20.part_1(input)),
|
||||
21 => Some(Day21.part_1(input)),
|
||||
22 => Some(Day22.part_1(input)),
|
||||
23 => Some(Day23.part_1(input)),
|
||||
24 => Some(Day24.part_1(input)),
|
||||
25 => Some(Day25.part_1(input)),
|
||||
_ => None
|
||||
},
|
||||
2 => match day {
|
||||
1 => Some(Day01.part_2(input)),
|
||||
2 => Some(Day02.part_2(input)),
|
||||
3 => Some(Day03.part_2(input)),
|
||||
4 => Some(Day04.part_2(input)),
|
||||
5 => Some(Day05.part_2(input)),
|
||||
6 => Some(Day06.part_2(input)),
|
||||
7 => Some(Day07.part_2(input)),
|
||||
8 => Some(Day08.part_2(input)),
|
||||
9 => Some(Day09.part_2(input)),
|
||||
10 => Some(Day10.part_2(input)),
|
||||
11 => Some(Day11.part_2(input)),
|
||||
12 => Some(Day12.part_2(input)),
|
||||
13 => Some(Day13.part_2(input)),
|
||||
14 => Some(Day14.part_2(input)),
|
||||
15 => Some(Day15.part_2(input)),
|
||||
16 => Some(Day16.part_2(input)),
|
||||
17 => Some(Day17.part_2(input)),
|
||||
18 => Some(Day18.part_2(input)),
|
||||
19 => Some(Day19.part_2(input)),
|
||||
20 => Some(Day20.part_2(input)),
|
||||
21 => Some(Day21.part_2(input)),
|
||||
22 => Some(Day22.part_2(input)),
|
||||
23 => Some(Day23.part_2(input)),
|
||||
24 => Some(Day24.part_2(input)),
|
||||
25 => Some(Day25.part_2(input)),
|
||||
_ => None
|
||||
},
|
||||
_ => None
|
||||
}
|
||||
}
|
||||
|
||||
mod day01;
|
||||
mod day02;
|
||||
mod day03;
|
||||
mod day04;
|
||||
mod day05;
|
||||
mod day06;
|
||||
mod day07;
|
||||
mod day08;
|
||||
mod day09;
|
||||
mod day10;
|
||||
mod day11;
|
||||
mod day12;
|
||||
mod day13;
|
||||
mod day14;
|
||||
mod day15;
|
||||
mod day16;
|
||||
mod day17;
|
||||
mod day18;
|
||||
mod day19;
|
||||
mod day20;
|
||||
mod day21;
|
||||
mod day22;
|
||||
mod day23;
|
||||
mod day24;
|
||||
mod day25;
|
||||
|
||||
#[test]
|
||||
fn examples() {
|
||||
todo!()
|
||||
}
|
||||
80
flake.lock
generated
80
flake.lock
generated
|
|
@ -1,80 +0,0 @@
|
|||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1681202837,
|
||||
"narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "cfacdce06f30d2b68473a46042957675eebb3401",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1703134684,
|
||||
"narHash": "sha256-SQmng1EnBFLzS7WSRyPM9HgmZP2kLJcPAz+Ug/nug6o=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "d6863cbcbbb80e71cecfc03356db1cda38919523",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "nixpkgs",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs",
|
||||
"rust-overlay": "rust-overlay"
|
||||
}
|
||||
},
|
||||
"rust-overlay": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1689302058,
|
||||
"narHash": "sha256-yD74lcHTrw4niXcE9goJLbzsgyce48rQQoy5jK5ZK40=",
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"rev": "7b8dbbf4c67ed05a9bf3d9e658c12d4108bc24c8",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
|
|
@ -1,9 +1,6 @@
|
|||
mod answer;
|
||||
mod input_data;
|
||||
mod solution;
|
||||
|
||||
pub use answer::Answer;
|
||||
pub use solution::Solution;
|
||||
|
||||
pub use input_data::{load_test, load_actual};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
use std::{fs, io};
|
||||
|
||||
pub fn load_actual(year: u64, day: u64) -> io::Result<String> {
|
||||
pub fn load_actual(year: usize, day: usize) -> io::Result<String> {
|
||||
let path = format!("./data/{year}/day{:02}", day);
|
||||
fs::read_to_string(path)
|
||||
}
|
||||
|
||||
pub fn load_test(year: u64, day: u64) -> io::Result<String> {
|
||||
pub fn load_test(year: usize, day: usize) -> io::Result<String> {
|
||||
let path = format!("./examples/{year}/day{:02}", day);
|
||||
fs::read_to_string(path)
|
||||
}
|
||||
48
src/main.rs
48
src/main.rs
|
|
@ -1,20 +1,50 @@
|
|||
use shared::Solution;
|
||||
mod solution;
|
||||
use solution::solution;
|
||||
|
||||
use shared::load_actual;
|
||||
mod input_data;
|
||||
use input_data::load_actual;
|
||||
|
||||
use std::time::Instant;
|
||||
use reqwest::blocking::Client;
|
||||
use reqwest::header::COOKIE;
|
||||
|
||||
use std::{time::Instant, env};
|
||||
|
||||
fn main() {
|
||||
let now = Instant::now();
|
||||
let year = 2024;
|
||||
let day = 2;
|
||||
|
||||
let Ok(data) = load_actual(2023, 12)
|
||||
let Ok(data) = load_actual(year, day)
|
||||
else { panic!("No Input Data"); };
|
||||
|
||||
let result = aoc2023::day12::Day12.part_2(&data);
|
||||
let now = Instant::now();
|
||||
|
||||
let elapsed = now.elapsed();
|
||||
let part1 = solution(&data, year, day, 1).unwrap();
|
||||
|
||||
println!("{}", result);
|
||||
let elapsed1 = now.elapsed();
|
||||
|
||||
let now = Instant::now();
|
||||
|
||||
let part2 = solution(&data, year, day, 2).unwrap();
|
||||
|
||||
let elapsed2 = now.elapsed();
|
||||
|
||||
println!("Part 1 result is {}, took {}ms", part1, elapsed1.as_millis());
|
||||
println!("Part 2 result is {}, took {}ms", part2, elapsed2.as_millis());
|
||||
|
||||
println!("{:?}", elapsed);
|
||||
}
|
||||
|
||||
fn fetch_data(year, day) -> Result<(), Box<dyn std::error::Error>> {
|
||||
let url = format!("https://adventofcode.com/{year}/day/{day}/input");
|
||||
let session_cookie = env::var("ADVENT_TOKEN")?;
|
||||
|
||||
let client = Client::new();
|
||||
let response = client
|
||||
.get(url)
|
||||
.header(COOKIE, session_cookie)
|
||||
.send()?;
|
||||
|
||||
let body = response.text()?;
|
||||
println!("Response: {}", body);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
10
src/solution.rs
Normal file
10
src/solution.rs
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
use shared::Answer;
|
||||
|
||||
|
||||
pub fn solution(input: &str, year: usize, day: usize, part: usize) -> Option<Answer> {
|
||||
match year {
|
||||
2023 => aoc2024::solution(input, day, part),
|
||||
2024 => aoc2024::solution(input, day, part),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
7
template/Cargo.toml
Normal file
7
template/Cargo.toml
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
[package]
|
||||
name = "aoc202X"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
shared = { path = "../shared" }
|
||||
13
template/src/day01.rs
Normal file
13
template/src/day01.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
use shared::{Solution, Answer};
|
||||
|
||||
pub struct Day01;
|
||||
|
||||
impl Solution for Day01 {
|
||||
fn part_1(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
|
||||
fn part_2(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
}
|
||||
13
template/src/day02.rs
Normal file
13
template/src/day02.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
use shared::{Solution, Answer};
|
||||
|
||||
pub struct Day02;
|
||||
|
||||
impl Solution for Day02 {
|
||||
fn part_1(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
|
||||
fn part_2(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
}
|
||||
13
template/src/day03.rs
Normal file
13
template/src/day03.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
use shared::{Solution, Answer};
|
||||
|
||||
pub struct Day03;
|
||||
|
||||
impl Solution for Day03 {
|
||||
fn part_1(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
|
||||
fn part_2(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
}
|
||||
13
template/src/day04.rs
Normal file
13
template/src/day04.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
use shared::{Solution, Answer};
|
||||
|
||||
pub struct Day04;
|
||||
|
||||
impl Solution for Day04 {
|
||||
fn part_1(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
|
||||
fn part_2(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
}
|
||||
13
template/src/day05.rs
Normal file
13
template/src/day05.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
use shared::{Solution, Answer};
|
||||
|
||||
pub struct Day05;
|
||||
|
||||
impl Solution for Day05 {
|
||||
fn part_1(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
|
||||
fn part_2(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
}
|
||||
13
template/src/day06.rs
Normal file
13
template/src/day06.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
use shared::{Solution, Answer};
|
||||
|
||||
pub struct Day06;
|
||||
|
||||
impl Solution for Day06 {
|
||||
fn part_1(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
|
||||
fn part_2(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
}
|
||||
13
template/src/day07.rs
Normal file
13
template/src/day07.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
use shared::{Solution, Answer};
|
||||
|
||||
pub struct Day07;
|
||||
|
||||
impl Solution for Day07 {
|
||||
fn part_1(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
|
||||
fn part_2(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
}
|
||||
13
template/src/day08.rs
Normal file
13
template/src/day08.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
use shared::{Solution, Answer};
|
||||
|
||||
pub struct Day08;
|
||||
|
||||
impl Solution for Day08 {
|
||||
fn part_1(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
|
||||
fn part_2(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
}
|
||||
13
template/src/day09.rs
Normal file
13
template/src/day09.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
use shared::{Solution, Answer};
|
||||
|
||||
pub struct Day09;
|
||||
|
||||
impl Solution for Day09 {
|
||||
fn part_1(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
|
||||
fn part_2(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
}
|
||||
13
template/src/day10.rs
Normal file
13
template/src/day10.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
use shared::{Solution, Answer};
|
||||
|
||||
pub struct Day10;
|
||||
|
||||
impl Solution for Day10 {
|
||||
fn part_1(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
|
||||
fn part_2(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
}
|
||||
13
template/src/day11.rs
Normal file
13
template/src/day11.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
use shared::{Solution, Answer};
|
||||
|
||||
pub struct Day11;
|
||||
|
||||
impl Solution for Day11 {
|
||||
fn part_1(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
|
||||
fn part_2(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
}
|
||||
13
template/src/day12.rs
Normal file
13
template/src/day12.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
use shared::{Solution, Answer};
|
||||
|
||||
pub struct Day12;
|
||||
|
||||
impl Solution for Day12 {
|
||||
fn part_1(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
|
||||
fn part_2(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
}
|
||||
13
template/src/day13.rs
Normal file
13
template/src/day13.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
use shared::{Solution, Answer};
|
||||
|
||||
pub struct Day13;
|
||||
|
||||
impl Solution for Day13 {
|
||||
fn part_1(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
|
||||
fn part_2(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
}
|
||||
13
template/src/day14.rs
Normal file
13
template/src/day14.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
use shared::{Solution, Answer};
|
||||
|
||||
pub struct Day14;
|
||||
|
||||
impl Solution for Day14 {
|
||||
fn part_1(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
|
||||
fn part_2(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
}
|
||||
13
template/src/day15.rs
Normal file
13
template/src/day15.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
use shared::{Solution, Answer};
|
||||
|
||||
pub struct Day15;
|
||||
|
||||
impl Solution for Day15 {
|
||||
fn part_1(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
|
||||
fn part_2(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
}
|
||||
13
template/src/day16.rs
Normal file
13
template/src/day16.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
use shared::{Solution, Answer};
|
||||
|
||||
pub struct Day16;
|
||||
|
||||
impl Solution for Day16 {
|
||||
fn part_1(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
|
||||
fn part_2(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
}
|
||||
13
template/src/day17.rs
Normal file
13
template/src/day17.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
use shared::{Solution, Answer};
|
||||
|
||||
pub struct Day17;
|
||||
|
||||
impl Solution for Day17 {
|
||||
fn part_1(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
|
||||
fn part_2(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
}
|
||||
13
template/src/day18.rs
Normal file
13
template/src/day18.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
use shared::{Solution, Answer};
|
||||
|
||||
pub struct Day18;
|
||||
|
||||
impl Solution for Day18 {
|
||||
fn part_1(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
|
||||
fn part_2(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
}
|
||||
13
template/src/day19.rs
Normal file
13
template/src/day19.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
use shared::{Solution, Answer};
|
||||
|
||||
pub struct Day19;
|
||||
|
||||
impl Solution for Day19 {
|
||||
fn part_1(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
|
||||
fn part_2(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
}
|
||||
13
template/src/day20.rs
Normal file
13
template/src/day20.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
use shared::{Solution, Answer};
|
||||
|
||||
pub struct Day20;
|
||||
|
||||
impl Solution for Day20 {
|
||||
fn part_1(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
|
||||
fn part_2(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
}
|
||||
13
template/src/day21.rs
Normal file
13
template/src/day21.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
use shared::{Solution, Answer};
|
||||
|
||||
pub struct Day21;
|
||||
|
||||
impl Solution for Day21 {
|
||||
fn part_1(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
|
||||
fn part_2(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
}
|
||||
13
template/src/day22.rs
Normal file
13
template/src/day22.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
use shared::{Solution, Answer};
|
||||
|
||||
pub struct Day22;
|
||||
|
||||
impl Solution for Day22 {
|
||||
fn part_1(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
|
||||
fn part_2(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
}
|
||||
13
template/src/day23.rs
Normal file
13
template/src/day23.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
use shared::{Solution, Answer};
|
||||
|
||||
pub struct Day23;
|
||||
|
||||
impl Solution for Day23 {
|
||||
fn part_1(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
|
||||
fn part_2(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
}
|
||||
13
template/src/day24.rs
Normal file
13
template/src/day24.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
use shared::{Solution, Answer};
|
||||
|
||||
pub struct Day24;
|
||||
|
||||
impl Solution for Day24 {
|
||||
fn part_1(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
|
||||
fn part_2(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
}
|
||||
13
template/src/day25.rs
Normal file
13
template/src/day25.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
use shared::{Solution, Answer};
|
||||
|
||||
pub struct Day25;
|
||||
|
||||
impl Solution for Day25 {
|
||||
fn part_1(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
|
||||
fn part_2(&self, input: &str) -> Answer {
|
||||
Answer::Unimplemented
|
||||
}
|
||||
}
|
||||
120
template/src/lib.rs
Normal file
120
template/src/lib.rs
Normal file
|
|
@ -0,0 +1,120 @@
|
|||
use shared::{Solution, Answer};
|
||||
|
||||
pub use crate::day01::Day01;
|
||||
pub use crate::day02::Day02;
|
||||
pub use crate::day03::Day03;
|
||||
pub use crate::day04::Day04;
|
||||
pub use crate::day05::Day05;
|
||||
pub use crate::day06::Day06;
|
||||
pub use crate::day07::Day07;
|
||||
pub use crate::day08::Day08;
|
||||
pub use crate::day09::Day09;
|
||||
pub use crate::day10::Day10;
|
||||
pub use crate::day11::Day11;
|
||||
pub use crate::day12::Day12;
|
||||
pub use crate::day13::Day13;
|
||||
pub use crate::day14::Day14;
|
||||
pub use crate::day15::Day15;
|
||||
pub use crate::day16::Day16;
|
||||
pub use crate::day17::Day17;
|
||||
pub use crate::day18::Day18;
|
||||
pub use crate::day19::Day19;
|
||||
pub use crate::day20::Day20;
|
||||
pub use crate::day21::Day21;
|
||||
pub use crate::day22::Day22;
|
||||
pub use crate::day23::Day23;
|
||||
pub use crate::day24::Day24;
|
||||
pub use crate::day25::Day25;
|
||||
|
||||
pub fn solution(input: &str, day: usize, part: usize) -> Option<Answer> {
|
||||
match part {
|
||||
1 => match day {
|
||||
1 => Some(Day01.part_1(input)),
|
||||
2 => Some(Day02.part_1(input)),
|
||||
3 => Some(Day03.part_1(input)),
|
||||
4 => Some(Day04.part_1(input)),
|
||||
5 => Some(Day05.part_1(input)),
|
||||
6 => Some(Day06.part_1(input)),
|
||||
7 => Some(Day07.part_1(input)),
|
||||
8 => Some(Day08.part_1(input)),
|
||||
9 => Some(Day09.part_1(input)),
|
||||
10 => Some(Day10.part_1(input)),
|
||||
11 => Some(Day11.part_1(input)),
|
||||
12 => Some(Day12.part_1(input)),
|
||||
13 => Some(Day13.part_1(input)),
|
||||
14 => Some(Day14.part_1(input)),
|
||||
15 => Some(Day15.part_1(input)),
|
||||
16 => Some(Day16.part_1(input)),
|
||||
17 => Some(Day17.part_1(input)),
|
||||
18 => Some(Day18.part_1(input)),
|
||||
19 => Some(Day19.part_1(input)),
|
||||
20 => Some(Day20.part_1(input)),
|
||||
21 => Some(Day21.part_1(input)),
|
||||
22 => Some(Day22.part_1(input)),
|
||||
23 => Some(Day23.part_1(input)),
|
||||
24 => Some(Day24.part_1(input)),
|
||||
25 => Some(Day25.part_1(input)),
|
||||
_ => None
|
||||
},
|
||||
2 => match day {
|
||||
1 => Some(Day01.part_2(input)),
|
||||
2 => Some(Day02.part_2(input)),
|
||||
3 => Some(Day03.part_2(input)),
|
||||
4 => Some(Day04.part_2(input)),
|
||||
5 => Some(Day05.part_2(input)),
|
||||
6 => Some(Day06.part_2(input)),
|
||||
7 => Some(Day07.part_2(input)),
|
||||
8 => Some(Day08.part_2(input)),
|
||||
9 => Some(Day09.part_2(input)),
|
||||
10 => Some(Day10.part_2(input)),
|
||||
11 => Some(Day11.part_2(input)),
|
||||
12 => Some(Day12.part_2(input)),
|
||||
13 => Some(Day13.part_2(input)),
|
||||
14 => Some(Day14.part_2(input)),
|
||||
15 => Some(Day15.part_2(input)),
|
||||
16 => Some(Day16.part_2(input)),
|
||||
17 => Some(Day17.part_2(input)),
|
||||
18 => Some(Day18.part_2(input)),
|
||||
19 => Some(Day19.part_2(input)),
|
||||
20 => Some(Day20.part_2(input)),
|
||||
21 => Some(Day21.part_2(input)),
|
||||
22 => Some(Day22.part_2(input)),
|
||||
23 => Some(Day23.part_2(input)),
|
||||
24 => Some(Day24.part_2(input)),
|
||||
25 => Some(Day25.part_2(input)),
|
||||
_ => None
|
||||
},
|
||||
_ => None
|
||||
}
|
||||
}
|
||||
|
||||
mod day01;
|
||||
mod day02;
|
||||
mod day03;
|
||||
mod day04;
|
||||
mod day05;
|
||||
mod day06;
|
||||
mod day07;
|
||||
mod day08;
|
||||
mod day09;
|
||||
mod day10;
|
||||
mod day11;
|
||||
mod day12;
|
||||
mod day13;
|
||||
mod day14;
|
||||
mod day15;
|
||||
mod day16;
|
||||
mod day17;
|
||||
mod day18;
|
||||
mod day19;
|
||||
mod day20;
|
||||
mod day21;
|
||||
mod day22;
|
||||
mod day23;
|
||||
mod day24;
|
||||
mod day25;
|
||||
|
||||
#[test]
|
||||
fn examples() {
|
||||
todo!()
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue