Compare commits
3 commits
294c0a8e62
...
a5fa4b628e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a5fa4b628e | ||
|
|
73e90776ed | ||
|
|
e1ca0d5f61 |
77 changed files with 4794 additions and 173 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/01x5k4nlxcpyd85nnr0b9gm89rm8ff4x-source
Symbolic link
1
.direnv/flake-inputs/01x5k4nlxcpyd85nnr0b9gm89rm8ff4x-source
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
/nix/store/01x5k4nlxcpyd85nnr0b9gm89rm8ff4x-source
|
||||
1
.direnv/flake-inputs/21j7n6lxhfshy95gi0zr4vwswgy294jm-source
Symbolic link
1
.direnv/flake-inputs/21j7n6lxhfshy95gi0zr4vwswgy294jm-source
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
/nix/store/21j7n6lxhfshy95gi0zr4vwswgy294jm-source
|
||||
1
.direnv/flake-inputs/63wl439w735818rb3sl7ks63raqzqxx2-source
Symbolic link
1
.direnv/flake-inputs/63wl439w735818rb3sl7ks63raqzqxx2-source
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
/nix/store/63wl439w735818rb3sl7ks63raqzqxx2-source
|
||||
1
.direnv/flake-inputs/ab78nf3ad8ly49zfyd3igw3f2n5q7fz4-source
Symbolic link
1
.direnv/flake-inputs/ab78nf3ad8ly49zfyd3igw3f2n5q7fz4-source
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
/nix/store/ab78nf3ad8ly49zfyd3igw3f2n5q7fz4-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-profile-a5d5b61aa8a61b7d9d765e1daf971a9a578f1cfa
Symbolic link
1
.direnv/flake-profile-a5d5b61aa8a61b7d9d765e1daf971a9a578f1cfa
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
/nix/store/3zv4qkyn3yqzksv0kbrbqy73yfpqi152-nix-shell-env
|
||||
2055
.direnv/flake-profile-a5d5b61aa8a61b7d9d765e1daf971a9a578f1cfa.rc
Normal file
2055
.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!()
|
||||
}
|
||||
26
flake.lock
generated
26
flake.lock
generated
|
|
@ -5,11 +5,11 @@
|
|||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1681202837,
|
||||
"narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=",
|
||||
"lastModified": 1731533236,
|
||||
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "cfacdce06f30d2b68473a46042957675eebb3401",
|
||||
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -20,37 +20,39 @@
|
|||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1703134684,
|
||||
"narHash": "sha256-SQmng1EnBFLzS7WSRyPM9HgmZP2kLJcPAz+Ug/nug6o=",
|
||||
"lastModified": 1733015953,
|
||||
"narHash": "sha256-t4BBVpwG9B4hLgc6GUBuj3cjU7lP/PJfpTHuSqE+crk=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "d6863cbcbbb80e71cecfc03356db1cda38919523",
|
||||
"rev": "ac35b104800bff9028425fec3b6e8a41de2bbfff",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "nixpkgs",
|
||||
"type": "indirect"
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"rust-overlay": "rust-overlay"
|
||||
}
|
||||
},
|
||||
"rust-overlay": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1689302058,
|
||||
"narHash": "sha256-yD74lcHTrw4niXcE9goJLbzsgyce48rQQoy5jK5ZK40=",
|
||||
"lastModified": 1733106880,
|
||||
"narHash": "sha256-aJmAIjZfWfPSWSExwrYBLRgXVvgF5LP1vaeUGOOIQ98=",
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"rev": "7b8dbbf4c67ed05a9bf3d9e658c12d4108bc24c8",
|
||||
"rev": "e66c0d43abf5bdefb664c3583ca8994983c332ae",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
|
|||
69
flake.nix
69
flake.nix
|
|
@ -1,7 +1,9 @@
|
|||
{
|
||||
description = "A Nix-flake-based Rust development environment";
|
||||
description = "Dev Shell for AdventOfCode by lilith";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
rust-overlay = {
|
||||
url = "github:oxalica/rust-overlay";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
|
@ -9,42 +11,35 @@
|
|||
};
|
||||
|
||||
outputs = {
|
||||
self,
|
||||
nixpkgs,
|
||||
rust-overlay,
|
||||
}: let
|
||||
overlays = [
|
||||
rust-overlay.overlays.default
|
||||
(final: prev: {
|
||||
rustToolchain = let
|
||||
rust = prev.rust-bin;
|
||||
in
|
||||
if builtins.pathExists ./rust-toolchain.toml
|
||||
then rust.fromRustupToolchainFile ./rust-toolchain.toml
|
||||
else if builtins.pathExists ./rust-toolchain
|
||||
then rust.fromRustupToolchainFile ./rust-toolchain
|
||||
else rust.stable.latest.default;
|
||||
})
|
||||
];
|
||||
supportedSystems = ["x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"];
|
||||
forEachSupportedSystem = f:
|
||||
nixpkgs.lib.genAttrs supportedSystems (system:
|
||||
f {
|
||||
pkgs = import nixpkgs {inherit overlays system;};
|
||||
});
|
||||
in {
|
||||
devShells = forEachSupportedSystem ({pkgs}: {
|
||||
default = pkgs.mkShell {
|
||||
packages = with pkgs; [
|
||||
rustToolchain
|
||||
openssl
|
||||
pkg-config
|
||||
cargo-deny
|
||||
cargo-edit
|
||||
cargo-watch
|
||||
rust-analyzer
|
||||
];
|
||||
};
|
||||
});
|
||||
};
|
||||
flake-utils,
|
||||
...
|
||||
}:
|
||||
flake-utils.lib.eachDefaultSystem (
|
||||
system: let
|
||||
overlays = [(import rust-overlay)];
|
||||
pkgs = import nixpkgs {
|
||||
inherit system overlays;
|
||||
};
|
||||
in {
|
||||
devShells.default = with pkgs;
|
||||
mkShell {
|
||||
buildInputs = [
|
||||
openssl
|
||||
pkg-config
|
||||
cargo-deny
|
||||
cargo-edit
|
||||
cargo-watch
|
||||
rust-analyzer
|
||||
(
|
||||
rust-bin.selectLatestNightlyWith (toolchain:
|
||||
toolchain.default.override {
|
||||
extensions = ["rust-src"];
|
||||
})
|
||||
)
|
||||
];
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
50
src/main.rs
50
src/main.rs
|
|
@ -1,20 +1,52 @@
|
|||
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 year = 2024;
|
||||
let day = 2;
|
||||
|
||||
fetch_data(year, day).unwrap();
|
||||
|
||||
let Ok(data) = load_actual(year, day)
|
||||
else { panic!("No Input Data"); };
|
||||
|
||||
let now = Instant::now();
|
||||
|
||||
let Ok(data) = load_actual(2023, 12)
|
||||
else { panic!("No Input Data"); };
|
||||
let part1 = solution(&data, year, day, 1).unwrap();
|
||||
|
||||
let result = aoc2023::day12::Day12.part_2(&data);
|
||||
let elapsed1 = now.elapsed();
|
||||
|
||||
let elapsed = now.elapsed();
|
||||
let now = Instant::now();
|
||||
|
||||
let part2 = solution(&data, year, day, 2).unwrap();
|
||||
|
||||
println!("{}", result);
|
||||
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: usize, day: usize) -> 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