generated from luke-else/AdventOfCodeXXXX
Initial commit
This commit is contained in:
25
.devcontainer/devcontainer.json
Normal file
25
.devcontainer/devcontainer.json
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
"name": "AOC",
|
||||||
|
"image": "git.luke-else.co.uk/luke-else/rust-dev:latest",
|
||||||
|
"remoteUser": "dev",
|
||||||
|
"customizations": {
|
||||||
|
"vscode": {
|
||||||
|
"settings": {
|
||||||
|
"editor.formatOnSave": true,
|
||||||
|
"[rust]": {
|
||||||
|
"editor.defaultFormatter": "rust-lang.rust-analyzer"
|
||||||
|
},
|
||||||
|
"rust-analyzer.cargo.runBuildScripts": true
|
||||||
|
},
|
||||||
|
"extensions": [
|
||||||
|
"ms-azuretools.vscode-docker",
|
||||||
|
"rust-lang.rust-analyzer",
|
||||||
|
"tamasfe.even-better-toml",
|
||||||
|
"vadimcn.vscode-lldb",
|
||||||
|
"dustypomerleau.rust-syntax"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"postCreateCommand": "cargo fetch"
|
||||||
|
}
|
||||||
|
|
||||||
56
.gitea/workflows/test.yaml
Normal file
56
.gitea/workflows/test.yaml
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
name: Continuous integration
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
check:
|
||||||
|
name: Check
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
|
with:
|
||||||
|
cache: false
|
||||||
|
- run: cargo check
|
||||||
|
|
||||||
|
test:
|
||||||
|
name: Test Suite
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
|
with:
|
||||||
|
cache: false
|
||||||
|
- run: cargo test
|
||||||
|
|
||||||
|
fmt:
|
||||||
|
name: Rustfmt
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
|
with:
|
||||||
|
cache: false
|
||||||
|
- run: rustup component add rustfmt
|
||||||
|
- run: cargo fmt --all -- --check
|
||||||
|
|
||||||
|
clippy:
|
||||||
|
name: Clippy
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
|
with:
|
||||||
|
cache: false
|
||||||
|
- run: rustup component add clippy
|
||||||
|
- run: cargo clippy -- -D warnings
|
||||||
|
|
||||||
|
build:
|
||||||
|
name: build
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
|
with:
|
||||||
|
cache: false
|
||||||
|
- run: cargo build
|
||||||
30
.gitignore
vendored
Normal file
30
.gitignore
vendored
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
# ---> VisualStudioCode
|
||||||
|
.vscode/*
|
||||||
|
!.vscode/settings.json
|
||||||
|
!.vscode/tasks.json
|
||||||
|
!.vscode/launch.json
|
||||||
|
!.vscode/extensions.json
|
||||||
|
!.vscode/*.code-snippets
|
||||||
|
|
||||||
|
# Local History for Visual Studio Code
|
||||||
|
.history/
|
||||||
|
|
||||||
|
# Built Visual Studio Code Extensions
|
||||||
|
*.vsix
|
||||||
|
|
||||||
|
# ---> Rust
|
||||||
|
# Generated by Cargo
|
||||||
|
# will have compiled files and executables
|
||||||
|
debug/
|
||||||
|
target/
|
||||||
|
|
||||||
|
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
|
||||||
|
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
|
||||||
|
Cargo.lock
|
||||||
|
|
||||||
|
# These are backup files generated by rustfmt
|
||||||
|
**/*.rs.bk
|
||||||
|
|
||||||
|
# MSVC Windows builds of rustc generate these, which store debugging information
|
||||||
|
*.pdb
|
||||||
|
|
||||||
7
Cargo.toml
Normal file
7
Cargo.toml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
[package]
|
||||||
|
name = "advent_of_code_XXXX"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
tokio = {version = "1.41.1", features = ["full"]}
|
||||||
9
LICENSE
Normal file
9
LICENSE
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2024 luke-else
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
3
README.md
Normal file
3
README.md
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# AdventOfCodeXXXX
|
||||||
|
|
||||||
|
Advent of Code XXXX Written in Rust.
|
||||||
BIN
assets/images/main.png
Normal file
BIN
assets/images/main.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 28 KiB |
0
input/day01
Normal file
0
input/day01
Normal file
0
input/day01_test1
Normal file
0
input/day01_test1
Normal file
0
input/day01_test2
Normal file
0
input/day01_test2
Normal file
0
input/day02
Normal file
0
input/day02
Normal file
0
input/day02_test1
Normal file
0
input/day02_test1
Normal file
0
input/day02_test2
Normal file
0
input/day02_test2
Normal file
0
input/day03
Normal file
0
input/day03
Normal file
0
input/day03_test1
Normal file
0
input/day03_test1
Normal file
0
input/day03_test2
Normal file
0
input/day03_test2
Normal file
0
input/day04
Normal file
0
input/day04
Normal file
0
input/day04_test1
Normal file
0
input/day04_test1
Normal file
0
input/day04_test2
Normal file
0
input/day04_test2
Normal file
0
input/day05
Normal file
0
input/day05
Normal file
0
input/day05_test1
Normal file
0
input/day05_test1
Normal file
0
input/day05_test2
Normal file
0
input/day05_test2
Normal file
0
input/day06
Normal file
0
input/day06
Normal file
0
input/day06_test1
Normal file
0
input/day06_test1
Normal file
0
input/day06_test2
Normal file
0
input/day06_test2
Normal file
0
input/day07
Normal file
0
input/day07
Normal file
0
input/day07_test1
Normal file
0
input/day07_test1
Normal file
0
input/day07_test2
Normal file
0
input/day07_test2
Normal file
0
input/day08
Normal file
0
input/day08
Normal file
0
input/day08_test1
Normal file
0
input/day08_test1
Normal file
0
input/day08_test2
Normal file
0
input/day08_test2
Normal file
0
input/day09
Normal file
0
input/day09
Normal file
0
input/day09_test1
Normal file
0
input/day09_test1
Normal file
0
input/day09_test2
Normal file
0
input/day09_test2
Normal file
0
input/day10
Normal file
0
input/day10
Normal file
0
input/day10_test1
Normal file
0
input/day10_test1
Normal file
0
input/day10_test2
Normal file
0
input/day10_test2
Normal file
0
input/day11
Normal file
0
input/day11
Normal file
0
input/day11_test1
Normal file
0
input/day11_test1
Normal file
0
input/day11_test2
Normal file
0
input/day11_test2
Normal file
0
input/day12
Normal file
0
input/day12
Normal file
0
input/day12_test1
Normal file
0
input/day12_test1
Normal file
0
input/day12_test2
Normal file
0
input/day12_test2
Normal file
0
input/day13
Normal file
0
input/day13
Normal file
0
input/day13_test1
Normal file
0
input/day13_test1
Normal file
0
input/day13_test2
Normal file
0
input/day13_test2
Normal file
0
input/day14
Normal file
0
input/day14
Normal file
0
input/day14_test1
Normal file
0
input/day14_test1
Normal file
0
input/day14_test2
Normal file
0
input/day14_test2
Normal file
0
input/day15
Normal file
0
input/day15
Normal file
0
input/day15_test1
Normal file
0
input/day15_test1
Normal file
0
input/day15_test2
Normal file
0
input/day15_test2
Normal file
0
input/day16
Normal file
0
input/day16
Normal file
0
input/day16_test1
Normal file
0
input/day16_test1
Normal file
0
input/day16_test2
Normal file
0
input/day16_test2
Normal file
0
input/day17
Normal file
0
input/day17
Normal file
0
input/day17_test1
Normal file
0
input/day17_test1
Normal file
0
input/day17_test2
Normal file
0
input/day17_test2
Normal file
0
input/day18
Normal file
0
input/day18
Normal file
0
input/day18_test1
Normal file
0
input/day18_test1
Normal file
0
input/day18_test2
Normal file
0
input/day18_test2
Normal file
0
input/day19
Normal file
0
input/day19
Normal file
0
input/day19_test1
Normal file
0
input/day19_test1
Normal file
0
input/day19_test2
Normal file
0
input/day19_test2
Normal file
0
input/day20
Normal file
0
input/day20
Normal file
0
input/day20_test1
Normal file
0
input/day20_test1
Normal file
0
input/day20_test2
Normal file
0
input/day20_test2
Normal file
0
input/day21
Normal file
0
input/day21
Normal file
0
input/day21_test1
Normal file
0
input/day21_test1
Normal file
0
input/day21_test2
Normal file
0
input/day21_test2
Normal file
0
input/day22
Normal file
0
input/day22
Normal file
0
input/day22_test1
Normal file
0
input/day22_test1
Normal file
0
input/day22_test2
Normal file
0
input/day22_test2
Normal file
0
input/day23
Normal file
0
input/day23
Normal file
0
input/day23_test1
Normal file
0
input/day23_test1
Normal file
0
input/day23_test2
Normal file
0
input/day23_test2
Normal file
0
input/day24
Normal file
0
input/day24
Normal file
0
input/day24_test1
Normal file
0
input/day24_test1
Normal file
0
input/day24_test2
Normal file
0
input/day24_test2
Normal file
0
input/day25
Normal file
0
input/day25
Normal file
0
input/day25_test1
Normal file
0
input/day25_test1
Normal file
0
input/day25_test2
Normal file
0
input/day25_test2
Normal file
68
src/main.rs
Normal file
68
src/main.rs
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
mod solutions;
|
||||||
|
mod utils;
|
||||||
|
|
||||||
|
use std::{error::Error, time::SystemTime};
|
||||||
|
|
||||||
|
use solutions::*;
|
||||||
|
|
||||||
|
#[tokio::main]
|
||||||
|
async fn main() -> Result<(), Box<dyn Error>> {
|
||||||
|
/* Uncomment these before the start of each day! */
|
||||||
|
let days: Vec<Box<dyn Solution>> = vec![
|
||||||
|
Box::new(day01::Day01 {}),
|
||||||
|
// Box::new(day02::Day02 {}),
|
||||||
|
// Box::new(day03::Day03 {}),
|
||||||
|
// Box::new(day04::Day04 {}),
|
||||||
|
// Box::new(day05::Day05 {}),
|
||||||
|
// Box::new(day06::Day06 {}),
|
||||||
|
// Box::new(day07::Day07 {}),
|
||||||
|
// Box::new(day08::Day08 {}),
|
||||||
|
// Box::new(day09::Day09 {}),
|
||||||
|
// Box::new(day10::Day10 {}),
|
||||||
|
// Box::new(day11::Day11 {}),
|
||||||
|
// Box::new(day12::Day12 {}),
|
||||||
|
// Box::new(day13::Day13 {}),
|
||||||
|
// Box::new(day14::Day14 {}),
|
||||||
|
// Box::new(day15::Day15 {}),
|
||||||
|
// Box::new(day16::Day16 {}),
|
||||||
|
// Box::new(day17::Day17 {}),
|
||||||
|
// Box::new(day18::Day18 {}),
|
||||||
|
// Box::new(day19::Day19 {}),
|
||||||
|
// Box::new(day20::Day20 {}),
|
||||||
|
// Box::new(day21::Day21 {}),
|
||||||
|
// Box::new(day22::Day22 {}),
|
||||||
|
// Box::new(day23::Day23 {}),
|
||||||
|
// Box::new(day24::Day24 {}),
|
||||||
|
// Box::new(day25::Day25 {}),
|
||||||
|
];
|
||||||
|
|
||||||
|
// Vector to store every solution as a thread handle
|
||||||
|
let mut t = vec![];
|
||||||
|
|
||||||
|
// Run through and construct solution objects
|
||||||
|
for day in days {
|
||||||
|
let task = tokio::spawn(async move { day.run().unwrap() });
|
||||||
|
t.push(task);
|
||||||
|
}
|
||||||
|
|
||||||
|
let start_time = SystemTime::now();
|
||||||
|
|
||||||
|
// When thread is awaited, the solution is run
|
||||||
|
let mut days = vec![];
|
||||||
|
for thread in t {
|
||||||
|
days.push(thread.await?);
|
||||||
|
}
|
||||||
|
|
||||||
|
for day in days {
|
||||||
|
println!("========= Day {} ==========", day.day);
|
||||||
|
println!("Part1 Result: {}", day.part1);
|
||||||
|
println!("Part2 Result: {}", day.part2);
|
||||||
|
println!("========= {}ms =========\n", day.time.as_millis());
|
||||||
|
}
|
||||||
|
|
||||||
|
println!(
|
||||||
|
"Ran AoC 2023 in {}ms",
|
||||||
|
SystemTime::now().duration_since(start_time)?.as_millis()
|
||||||
|
);
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
66
src/solutions/day01.rs
Normal file
66
src/solutions/day01.rs
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
use super::Solution;
|
||||||
|
|
||||||
|
pub struct Day01 {}
|
||||||
|
|
||||||
|
impl Solution for Day01 {
|
||||||
|
fn part1(
|
||||||
|
&self,
|
||||||
|
_input: &mut Vec<String>,
|
||||||
|
) -> Result<Box<dyn std::fmt::Display>, Box<dyn std::error::Error>> {
|
||||||
|
Ok(Box::new("Ready"))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn part2(
|
||||||
|
&self,
|
||||||
|
_input: &mut Vec<String>,
|
||||||
|
) -> Result<Box<dyn std::fmt::Display>, Box<dyn std::error::Error>> {
|
||||||
|
Ok(Box::new("Ready"))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_day(&self) -> u8 {
|
||||||
|
1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Day01 {}
|
||||||
|
|
||||||
|
/// Test from puzzle input
|
||||||
|
#[cfg(test)]
|
||||||
|
mod test {
|
||||||
|
use super::*;
|
||||||
|
use crate::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn part1() {
|
||||||
|
let challenge = day01::Day01 {};
|
||||||
|
|
||||||
|
//Complete the Challenge
|
||||||
|
let answer = challenge
|
||||||
|
.part1(
|
||||||
|
utils::get_input(challenge.get_day(), utils::InputType::Test1)
|
||||||
|
.unwrap()
|
||||||
|
.as_mut(),
|
||||||
|
)
|
||||||
|
.unwrap()
|
||||||
|
.to_string();
|
||||||
|
|
||||||
|
assert_eq!(answer, "Ready");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn part2() {
|
||||||
|
let challenge = day01::Day01 {};
|
||||||
|
|
||||||
|
//Complete the Challenge
|
||||||
|
let answer = challenge
|
||||||
|
.part2(
|
||||||
|
utils::get_input(challenge.get_day(), utils::InputType::Test2)
|
||||||
|
.unwrap()
|
||||||
|
.as_mut(),
|
||||||
|
)
|
||||||
|
.unwrap()
|
||||||
|
.to_string();
|
||||||
|
|
||||||
|
assert_eq!(answer, "Ready");
|
||||||
|
}
|
||||||
|
}
|
||||||
66
src/solutions/day02.rs
Normal file
66
src/solutions/day02.rs
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
use super::Solution;
|
||||||
|
|
||||||
|
pub struct Day02 {}
|
||||||
|
|
||||||
|
impl Solution for Day02 {
|
||||||
|
fn part1(
|
||||||
|
&self,
|
||||||
|
_input: &mut Vec<String>,
|
||||||
|
) -> Result<Box<dyn std::fmt::Display>, Box<dyn std::error::Error>> {
|
||||||
|
Ok(Box::new("Ready"))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn part2(
|
||||||
|
&self,
|
||||||
|
_input: &mut Vec<String>,
|
||||||
|
) -> Result<Box<dyn std::fmt::Display>, Box<dyn std::error::Error>> {
|
||||||
|
Ok(Box::new("Ready"))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_day(&self) -> u8 {
|
||||||
|
2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Day02 {}
|
||||||
|
|
||||||
|
/// Test from puzzle input
|
||||||
|
#[cfg(test)]
|
||||||
|
mod test {
|
||||||
|
use super::*;
|
||||||
|
use crate::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn part1() {
|
||||||
|
let challenge = day02::Day02 {};
|
||||||
|
|
||||||
|
//Complete the Challenge
|
||||||
|
let answer = challenge
|
||||||
|
.part1(
|
||||||
|
utils::get_input(challenge.get_day(), utils::InputType::Test1)
|
||||||
|
.unwrap()
|
||||||
|
.as_mut(),
|
||||||
|
)
|
||||||
|
.unwrap()
|
||||||
|
.to_string();
|
||||||
|
|
||||||
|
assert_eq!(answer, "Ready");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn part2() {
|
||||||
|
let challenge = day02::Day02 {};
|
||||||
|
|
||||||
|
//Complete the Challenge
|
||||||
|
let answer = challenge
|
||||||
|
.part2(
|
||||||
|
utils::get_input(challenge.get_day(), utils::InputType::Test2)
|
||||||
|
.unwrap()
|
||||||
|
.as_mut(),
|
||||||
|
)
|
||||||
|
.unwrap()
|
||||||
|
.to_string();
|
||||||
|
|
||||||
|
assert_eq!(answer, "Ready");
|
||||||
|
}
|
||||||
|
}
|
||||||
66
src/solutions/day03.rs
Normal file
66
src/solutions/day03.rs
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
use super::Solution;
|
||||||
|
|
||||||
|
pub struct Day03 {}
|
||||||
|
|
||||||
|
impl Solution for Day03 {
|
||||||
|
fn part1(
|
||||||
|
&self,
|
||||||
|
_input: &mut Vec<String>,
|
||||||
|
) -> Result<Box<dyn std::fmt::Display>, Box<dyn std::error::Error>> {
|
||||||
|
Ok(Box::new("Ready"))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn part2(
|
||||||
|
&self,
|
||||||
|
_input: &mut Vec<String>,
|
||||||
|
) -> Result<Box<dyn std::fmt::Display>, Box<dyn std::error::Error>> {
|
||||||
|
Ok(Box::new("Ready"))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_day(&self) -> u8 {
|
||||||
|
3
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Day03 {}
|
||||||
|
|
||||||
|
/// Test from puzzle input
|
||||||
|
#[cfg(test)]
|
||||||
|
mod test {
|
||||||
|
use super::*;
|
||||||
|
use crate::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn part1() {
|
||||||
|
let challenge = day03::Day03 {};
|
||||||
|
|
||||||
|
//Complete the Challenge
|
||||||
|
let answer = challenge
|
||||||
|
.part1(
|
||||||
|
utils::get_input(challenge.get_day(), utils::InputType::Test1)
|
||||||
|
.unwrap()
|
||||||
|
.as_mut(),
|
||||||
|
)
|
||||||
|
.unwrap()
|
||||||
|
.to_string();
|
||||||
|
|
||||||
|
assert_eq!(answer, "Ready");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn part2() {
|
||||||
|
let challenge = day03::Day03 {};
|
||||||
|
|
||||||
|
//Complete the Challenge
|
||||||
|
let answer = challenge
|
||||||
|
.part2(
|
||||||
|
utils::get_input(challenge.get_day(), utils::InputType::Test2)
|
||||||
|
.unwrap()
|
||||||
|
.as_mut(),
|
||||||
|
)
|
||||||
|
.unwrap()
|
||||||
|
.to_string();
|
||||||
|
|
||||||
|
assert_eq!(answer, "Ready");
|
||||||
|
}
|
||||||
|
}
|
||||||
66
src/solutions/day04.rs
Normal file
66
src/solutions/day04.rs
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
use super::Solution;
|
||||||
|
|
||||||
|
pub struct Day04 {}
|
||||||
|
|
||||||
|
impl Solution for Day04 {
|
||||||
|
fn part1(
|
||||||
|
&self,
|
||||||
|
_input: &mut Vec<String>,
|
||||||
|
) -> Result<Box<dyn std::fmt::Display>, Box<dyn std::error::Error>> {
|
||||||
|
Ok(Box::new("Ready"))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn part2(
|
||||||
|
&self,
|
||||||
|
_input: &mut Vec<String>,
|
||||||
|
) -> Result<Box<dyn std::fmt::Display>, Box<dyn std::error::Error>> {
|
||||||
|
Ok(Box::new("Ready"))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_day(&self) -> u8 {
|
||||||
|
4
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Day04 {}
|
||||||
|
|
||||||
|
/// Test from puzzle input
|
||||||
|
#[cfg(test)]
|
||||||
|
mod test {
|
||||||
|
use super::*;
|
||||||
|
use crate::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn part1() {
|
||||||
|
let challenge = day04::Day04 {};
|
||||||
|
|
||||||
|
//Complete the Challenge
|
||||||
|
let answer = challenge
|
||||||
|
.part1(
|
||||||
|
utils::get_input(challenge.get_day(), utils::InputType::Test1)
|
||||||
|
.unwrap()
|
||||||
|
.as_mut(),
|
||||||
|
)
|
||||||
|
.unwrap()
|
||||||
|
.to_string();
|
||||||
|
|
||||||
|
assert_eq!(answer, "Ready");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn part2() {
|
||||||
|
let challenge = day04::Day04 {};
|
||||||
|
|
||||||
|
//Complete the Challenge
|
||||||
|
let answer = challenge
|
||||||
|
.part2(
|
||||||
|
utils::get_input(challenge.get_day(), utils::InputType::Test2)
|
||||||
|
.unwrap()
|
||||||
|
.as_mut(),
|
||||||
|
)
|
||||||
|
.unwrap()
|
||||||
|
.to_string();
|
||||||
|
|
||||||
|
assert_eq!(answer, "Ready");
|
||||||
|
}
|
||||||
|
}
|
||||||
66
src/solutions/day05.rs
Normal file
66
src/solutions/day05.rs
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
use super::Solution;
|
||||||
|
|
||||||
|
pub struct Day05 {}
|
||||||
|
|
||||||
|
impl Solution for Day05 {
|
||||||
|
fn part1(
|
||||||
|
&self,
|
||||||
|
_input: &mut Vec<String>,
|
||||||
|
) -> Result<Box<dyn std::fmt::Display>, Box<dyn std::error::Error>> {
|
||||||
|
Ok(Box::new("Ready"))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn part2(
|
||||||
|
&self,
|
||||||
|
_input: &mut Vec<String>,
|
||||||
|
) -> Result<Box<dyn std::fmt::Display>, Box<dyn std::error::Error>> {
|
||||||
|
Ok(Box::new("Ready"))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_day(&self) -> u8 {
|
||||||
|
5
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Day05 {}
|
||||||
|
|
||||||
|
/// Test from puzzle input
|
||||||
|
#[cfg(test)]
|
||||||
|
mod test {
|
||||||
|
use super::*;
|
||||||
|
use crate::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn part1() {
|
||||||
|
let challenge = day05::Day05 {};
|
||||||
|
|
||||||
|
//Complete the Challenge
|
||||||
|
let answer = challenge
|
||||||
|
.part1(
|
||||||
|
utils::get_input(challenge.get_day(), utils::InputType::Test1)
|
||||||
|
.unwrap()
|
||||||
|
.as_mut(),
|
||||||
|
)
|
||||||
|
.unwrap()
|
||||||
|
.to_string();
|
||||||
|
|
||||||
|
assert_eq!(answer, "Ready");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn part2() {
|
||||||
|
let challenge = day05::Day05 {};
|
||||||
|
|
||||||
|
//Complete the Challenge
|
||||||
|
let answer = challenge
|
||||||
|
.part2(
|
||||||
|
utils::get_input(challenge.get_day(), utils::InputType::Test2)
|
||||||
|
.unwrap()
|
||||||
|
.as_mut(),
|
||||||
|
)
|
||||||
|
.unwrap()
|
||||||
|
.to_string();
|
||||||
|
|
||||||
|
assert_eq!(answer, "Ready");
|
||||||
|
}
|
||||||
|
}
|
||||||
66
src/solutions/day06.rs
Normal file
66
src/solutions/day06.rs
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
use super::Solution;
|
||||||
|
|
||||||
|
pub struct Day06 {}
|
||||||
|
|
||||||
|
impl Solution for Day06 {
|
||||||
|
fn part1(
|
||||||
|
&self,
|
||||||
|
_input: &mut Vec<String>,
|
||||||
|
) -> Result<Box<dyn std::fmt::Display>, Box<dyn std::error::Error>> {
|
||||||
|
Ok(Box::new("Ready"))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn part2(
|
||||||
|
&self,
|
||||||
|
_input: &mut Vec<String>,
|
||||||
|
) -> Result<Box<dyn std::fmt::Display>, Box<dyn std::error::Error>> {
|
||||||
|
Ok(Box::new("Ready"))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_day(&self) -> u8 {
|
||||||
|
6
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Day06 {}
|
||||||
|
|
||||||
|
/// Test from puzzle input
|
||||||
|
#[cfg(test)]
|
||||||
|
mod test {
|
||||||
|
use super::*;
|
||||||
|
use crate::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn part1() {
|
||||||
|
let challenge = day06::Day06 {};
|
||||||
|
|
||||||
|
//Complete the Challenge
|
||||||
|
let answer = challenge
|
||||||
|
.part1(
|
||||||
|
utils::get_input(challenge.get_day(), utils::InputType::Test1)
|
||||||
|
.unwrap()
|
||||||
|
.as_mut(),
|
||||||
|
)
|
||||||
|
.unwrap()
|
||||||
|
.to_string();
|
||||||
|
|
||||||
|
assert_eq!(answer, "Ready");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn part2() {
|
||||||
|
let challenge = day06::Day06 {};
|
||||||
|
|
||||||
|
//Complete the Challenge
|
||||||
|
let answer = challenge
|
||||||
|
.part2(
|
||||||
|
utils::get_input(challenge.get_day(), utils::InputType::Test2)
|
||||||
|
.unwrap()
|
||||||
|
.as_mut(),
|
||||||
|
)
|
||||||
|
.unwrap()
|
||||||
|
.to_string();
|
||||||
|
|
||||||
|
assert_eq!(answer, "Ready");
|
||||||
|
}
|
||||||
|
}
|
||||||
66
src/solutions/day07.rs
Normal file
66
src/solutions/day07.rs
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
use super::Solution;
|
||||||
|
|
||||||
|
pub struct Day07 {}
|
||||||
|
|
||||||
|
impl Solution for Day07 {
|
||||||
|
fn part1(
|
||||||
|
&self,
|
||||||
|
_input: &mut Vec<String>,
|
||||||
|
) -> Result<Box<dyn std::fmt::Display>, Box<dyn std::error::Error>> {
|
||||||
|
Ok(Box::new("Ready"))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn part2(
|
||||||
|
&self,
|
||||||
|
_input: &mut Vec<String>,
|
||||||
|
) -> Result<Box<dyn std::fmt::Display>, Box<dyn std::error::Error>> {
|
||||||
|
Ok(Box::new("Ready"))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_day(&self) -> u8 {
|
||||||
|
7
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Day07 {}
|
||||||
|
|
||||||
|
/// Test from puzzle input
|
||||||
|
#[cfg(test)]
|
||||||
|
mod test {
|
||||||
|
use super::*;
|
||||||
|
use crate::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn part1() {
|
||||||
|
let challenge = day07::Day07 {};
|
||||||
|
|
||||||
|
//Complete the Challenge
|
||||||
|
let answer = challenge
|
||||||
|
.part1(
|
||||||
|
utils::get_input(challenge.get_day(), utils::InputType::Test1)
|
||||||
|
.unwrap()
|
||||||
|
.as_mut(),
|
||||||
|
)
|
||||||
|
.unwrap()
|
||||||
|
.to_string();
|
||||||
|
|
||||||
|
assert_eq!(answer, "Ready");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn part2() {
|
||||||
|
let challenge = day07::Day07 {};
|
||||||
|
|
||||||
|
//Complete the Challenge
|
||||||
|
let answer = challenge
|
||||||
|
.part2(
|
||||||
|
utils::get_input(challenge.get_day(), utils::InputType::Test2)
|
||||||
|
.unwrap()
|
||||||
|
.as_mut(),
|
||||||
|
)
|
||||||
|
.unwrap()
|
||||||
|
.to_string();
|
||||||
|
|
||||||
|
assert_eq!(answer, "Ready");
|
||||||
|
}
|
||||||
|
}
|
||||||
66
src/solutions/day08.rs
Normal file
66
src/solutions/day08.rs
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
use super::Solution;
|
||||||
|
|
||||||
|
pub struct Day08 {}
|
||||||
|
|
||||||
|
impl Solution for Day08 {
|
||||||
|
fn part1(
|
||||||
|
&self,
|
||||||
|
_input: &mut Vec<String>,
|
||||||
|
) -> Result<Box<dyn std::fmt::Display>, Box<dyn std::error::Error>> {
|
||||||
|
Ok(Box::new("Ready"))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn part2(
|
||||||
|
&self,
|
||||||
|
_input: &mut Vec<String>,
|
||||||
|
) -> Result<Box<dyn std::fmt::Display>, Box<dyn std::error::Error>> {
|
||||||
|
Ok(Box::new("Ready"))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_day(&self) -> u8 {
|
||||||
|
8
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Day08 {}
|
||||||
|
|
||||||
|
/// Test from puzzle input
|
||||||
|
#[cfg(test)]
|
||||||
|
mod test {
|
||||||
|
use super::*;
|
||||||
|
use crate::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn part1() {
|
||||||
|
let challenge = day08::Day08 {};
|
||||||
|
|
||||||
|
//Complete the Challenge
|
||||||
|
let answer = challenge
|
||||||
|
.part1(
|
||||||
|
utils::get_input(challenge.get_day(), utils::InputType::Test1)
|
||||||
|
.unwrap()
|
||||||
|
.as_mut(),
|
||||||
|
)
|
||||||
|
.unwrap()
|
||||||
|
.to_string();
|
||||||
|
|
||||||
|
assert_eq!(answer, "Ready");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn part2() {
|
||||||
|
let challenge = day08::Day08 {};
|
||||||
|
|
||||||
|
//Complete the Challenge
|
||||||
|
let answer = challenge
|
||||||
|
.part2(
|
||||||
|
utils::get_input(challenge.get_day(), utils::InputType::Test2)
|
||||||
|
.unwrap()
|
||||||
|
.as_mut(),
|
||||||
|
)
|
||||||
|
.unwrap()
|
||||||
|
.to_string();
|
||||||
|
|
||||||
|
assert_eq!(answer, "Ready");
|
||||||
|
}
|
||||||
|
}
|
||||||
66
src/solutions/day09.rs
Normal file
66
src/solutions/day09.rs
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
use super::Solution;
|
||||||
|
|
||||||
|
pub struct Day09 {}
|
||||||
|
|
||||||
|
impl Solution for Day09 {
|
||||||
|
fn part1(
|
||||||
|
&self,
|
||||||
|
_input: &mut Vec<String>,
|
||||||
|
) -> Result<Box<dyn std::fmt::Display>, Box<dyn std::error::Error>> {
|
||||||
|
Ok(Box::new("Ready"))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn part2(
|
||||||
|
&self,
|
||||||
|
_input: &mut Vec<String>,
|
||||||
|
) -> Result<Box<dyn std::fmt::Display>, Box<dyn std::error::Error>> {
|
||||||
|
Ok(Box::new("Ready"))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_day(&self) -> u8 {
|
||||||
|
9
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Day09 {}
|
||||||
|
|
||||||
|
/// Test from puzzle input
|
||||||
|
#[cfg(test)]
|
||||||
|
mod test {
|
||||||
|
use super::*;
|
||||||
|
use crate::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn part1() {
|
||||||
|
let challenge = day09::Day09 {};
|
||||||
|
|
||||||
|
//Complete the Challenge
|
||||||
|
let answer = challenge
|
||||||
|
.part1(
|
||||||
|
utils::get_input(challenge.get_day(), utils::InputType::Test1)
|
||||||
|
.unwrap()
|
||||||
|
.as_mut(),
|
||||||
|
)
|
||||||
|
.unwrap()
|
||||||
|
.to_string();
|
||||||
|
|
||||||
|
assert_eq!(answer, "Ready");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn part2() {
|
||||||
|
let challenge = day09::Day09 {};
|
||||||
|
|
||||||
|
//Complete the Challenge
|
||||||
|
let answer = challenge
|
||||||
|
.part2(
|
||||||
|
utils::get_input(challenge.get_day(), utils::InputType::Test2)
|
||||||
|
.unwrap()
|
||||||
|
.as_mut(),
|
||||||
|
)
|
||||||
|
.unwrap()
|
||||||
|
.to_string();
|
||||||
|
|
||||||
|
assert_eq!(answer, "Ready");
|
||||||
|
}
|
||||||
|
}
|
||||||
66
src/solutions/day10.rs
Normal file
66
src/solutions/day10.rs
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
use super::Solution;
|
||||||
|
|
||||||
|
pub struct Day10 {}
|
||||||
|
|
||||||
|
impl Solution for Day10 {
|
||||||
|
fn part1(
|
||||||
|
&self,
|
||||||
|
_input: &mut Vec<String>,
|
||||||
|
) -> Result<Box<dyn std::fmt::Display>, Box<dyn std::error::Error>> {
|
||||||
|
Ok(Box::new("Ready"))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn part2(
|
||||||
|
&self,
|
||||||
|
_input: &mut Vec<String>,
|
||||||
|
) -> Result<Box<dyn std::fmt::Display>, Box<dyn std::error::Error>> {
|
||||||
|
Ok(Box::new("Ready"))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_day(&self) -> u8 {
|
||||||
|
10
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Day10 {}
|
||||||
|
|
||||||
|
/// Test from puzzle input
|
||||||
|
#[cfg(test)]
|
||||||
|
mod test {
|
||||||
|
use super::*;
|
||||||
|
use crate::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn part1() {
|
||||||
|
let challenge = day10::Day10 {};
|
||||||
|
|
||||||
|
//Complete the Challenge
|
||||||
|
let answer = challenge
|
||||||
|
.part1(
|
||||||
|
utils::get_input(challenge.get_day(), utils::InputType::Test1)
|
||||||
|
.unwrap()
|
||||||
|
.as_mut(),
|
||||||
|
)
|
||||||
|
.unwrap()
|
||||||
|
.to_string();
|
||||||
|
|
||||||
|
assert_eq!(answer, "Ready");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn part2() {
|
||||||
|
let challenge = day10::Day10 {};
|
||||||
|
|
||||||
|
//Complete the Challenge
|
||||||
|
let answer = challenge
|
||||||
|
.part2(
|
||||||
|
utils::get_input(challenge.get_day(), utils::InputType::Test2)
|
||||||
|
.unwrap()
|
||||||
|
.as_mut(),
|
||||||
|
)
|
||||||
|
.unwrap()
|
||||||
|
.to_string();
|
||||||
|
|
||||||
|
assert_eq!(answer, "Ready");
|
||||||
|
}
|
||||||
|
}
|
||||||
66
src/solutions/day11.rs
Normal file
66
src/solutions/day11.rs
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
use super::Solution;
|
||||||
|
|
||||||
|
pub struct Day11 {}
|
||||||
|
|
||||||
|
impl Solution for Day11 {
|
||||||
|
fn part1(
|
||||||
|
&self,
|
||||||
|
_input: &mut Vec<String>,
|
||||||
|
) -> Result<Box<dyn std::fmt::Display>, Box<dyn std::error::Error>> {
|
||||||
|
Ok(Box::new("Ready"))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn part2(
|
||||||
|
&self,
|
||||||
|
_input: &mut Vec<String>,
|
||||||
|
) -> Result<Box<dyn std::fmt::Display>, Box<dyn std::error::Error>> {
|
||||||
|
Ok(Box::new("Ready"))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_day(&self) -> u8 {
|
||||||
|
11
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Day11 {}
|
||||||
|
|
||||||
|
/// Test from puzzle input
|
||||||
|
#[cfg(test)]
|
||||||
|
mod test {
|
||||||
|
use super::*;
|
||||||
|
use crate::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn part1() {
|
||||||
|
let challenge = day11::Day11 {};
|
||||||
|
|
||||||
|
//Complete the Challenge
|
||||||
|
let answer = challenge
|
||||||
|
.part1(
|
||||||
|
utils::get_input(challenge.get_day(), utils::InputType::Test1)
|
||||||
|
.unwrap()
|
||||||
|
.as_mut(),
|
||||||
|
)
|
||||||
|
.unwrap()
|
||||||
|
.to_string();
|
||||||
|
|
||||||
|
assert_eq!(answer, "Ready");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn part2() {
|
||||||
|
let challenge = day11::Day11 {};
|
||||||
|
|
||||||
|
//Complete the Challenge
|
||||||
|
let answer = challenge
|
||||||
|
.part2(
|
||||||
|
utils::get_input(challenge.get_day(), utils::InputType::Test2)
|
||||||
|
.unwrap()
|
||||||
|
.as_mut(),
|
||||||
|
)
|
||||||
|
.unwrap()
|
||||||
|
.to_string();
|
||||||
|
|
||||||
|
assert_eq!(answer, "Ready");
|
||||||
|
}
|
||||||
|
}
|
||||||
66
src/solutions/day12.rs
Normal file
66
src/solutions/day12.rs
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
use super::Solution;
|
||||||
|
|
||||||
|
pub struct Day12 {}
|
||||||
|
|
||||||
|
impl Solution for Day12 {
|
||||||
|
fn part1(
|
||||||
|
&self,
|
||||||
|
_input: &mut Vec<String>,
|
||||||
|
) -> Result<Box<dyn std::fmt::Display>, Box<dyn std::error::Error>> {
|
||||||
|
Ok(Box::new("Ready"))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn part2(
|
||||||
|
&self,
|
||||||
|
_input: &mut Vec<String>,
|
||||||
|
) -> Result<Box<dyn std::fmt::Display>, Box<dyn std::error::Error>> {
|
||||||
|
Ok(Box::new("Ready"))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_day(&self) -> u8 {
|
||||||
|
12
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Day12 {}
|
||||||
|
|
||||||
|
/// Test from puzzle input
|
||||||
|
#[cfg(test)]
|
||||||
|
mod test {
|
||||||
|
use super::*;
|
||||||
|
use crate::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn part1() {
|
||||||
|
let challenge = day12::Day12 {};
|
||||||
|
|
||||||
|
//Complete the Challenge
|
||||||
|
let answer = challenge
|
||||||
|
.part1(
|
||||||
|
utils::get_input(challenge.get_day(), utils::InputType::Test1)
|
||||||
|
.unwrap()
|
||||||
|
.as_mut(),
|
||||||
|
)
|
||||||
|
.unwrap()
|
||||||
|
.to_string();
|
||||||
|
|
||||||
|
assert_eq!(answer, "Ready");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn part2() {
|
||||||
|
let challenge = day12::Day12 {};
|
||||||
|
|
||||||
|
//Complete the Challenge
|
||||||
|
let answer = challenge
|
||||||
|
.part2(
|
||||||
|
utils::get_input(challenge.get_day(), utils::InputType::Test2)
|
||||||
|
.unwrap()
|
||||||
|
.as_mut(),
|
||||||
|
)
|
||||||
|
.unwrap()
|
||||||
|
.to_string();
|
||||||
|
|
||||||
|
assert_eq!(answer, "Ready");
|
||||||
|
}
|
||||||
|
}
|
||||||
66
src/solutions/day13.rs
Normal file
66
src/solutions/day13.rs
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
use super::Solution;
|
||||||
|
|
||||||
|
pub struct Day13 {}
|
||||||
|
|
||||||
|
impl Solution for Day13 {
|
||||||
|
fn part1(
|
||||||
|
&self,
|
||||||
|
_input: &mut Vec<String>,
|
||||||
|
) -> Result<Box<dyn std::fmt::Display>, Box<dyn std::error::Error>> {
|
||||||
|
Ok(Box::new("Ready"))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn part2(
|
||||||
|
&self,
|
||||||
|
_input: &mut Vec<String>,
|
||||||
|
) -> Result<Box<dyn std::fmt::Display>, Box<dyn std::error::Error>> {
|
||||||
|
Ok(Box::new("Ready"))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_day(&self) -> u8 {
|
||||||
|
13
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Day13 {}
|
||||||
|
|
||||||
|
/// Test from puzzle input
|
||||||
|
#[cfg(test)]
|
||||||
|
mod test {
|
||||||
|
use super::*;
|
||||||
|
use crate::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn part1() {
|
||||||
|
let challenge = day13::Day13 {};
|
||||||
|
|
||||||
|
//Complete the Challenge
|
||||||
|
let answer = challenge
|
||||||
|
.part1(
|
||||||
|
utils::get_input(challenge.get_day(), utils::InputType::Test1)
|
||||||
|
.unwrap()
|
||||||
|
.as_mut(),
|
||||||
|
)
|
||||||
|
.unwrap()
|
||||||
|
.to_string();
|
||||||
|
|
||||||
|
assert_eq!(answer, "Ready");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn part2() {
|
||||||
|
let challenge = day13::Day13 {};
|
||||||
|
|
||||||
|
//Complete the Challenge
|
||||||
|
let answer = challenge
|
||||||
|
.part2(
|
||||||
|
utils::get_input(challenge.get_day(), utils::InputType::Test2)
|
||||||
|
.unwrap()
|
||||||
|
.as_mut(),
|
||||||
|
)
|
||||||
|
.unwrap()
|
||||||
|
.to_string();
|
||||||
|
|
||||||
|
assert_eq!(answer, "Ready");
|
||||||
|
}
|
||||||
|
}
|
||||||
66
src/solutions/day14.rs
Normal file
66
src/solutions/day14.rs
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
use super::Solution;
|
||||||
|
|
||||||
|
pub struct Day14 {}
|
||||||
|
|
||||||
|
impl Solution for Day14 {
|
||||||
|
fn part1(
|
||||||
|
&self,
|
||||||
|
_input: &mut Vec<String>,
|
||||||
|
) -> Result<Box<dyn std::fmt::Display>, Box<dyn std::error::Error>> {
|
||||||
|
Ok(Box::new("Ready"))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn part2(
|
||||||
|
&self,
|
||||||
|
_input: &mut Vec<String>,
|
||||||
|
) -> Result<Box<dyn std::fmt::Display>, Box<dyn std::error::Error>> {
|
||||||
|
Ok(Box::new("Ready"))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_day(&self) -> u8 {
|
||||||
|
14
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Day14 {}
|
||||||
|
|
||||||
|
/// Test from puzzle input
|
||||||
|
#[cfg(test)]
|
||||||
|
mod test {
|
||||||
|
use super::*;
|
||||||
|
use crate::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn part1() {
|
||||||
|
let challenge = day14::Day14 {};
|
||||||
|
|
||||||
|
//Complete the Challenge
|
||||||
|
let answer = challenge
|
||||||
|
.part1(
|
||||||
|
utils::get_input(challenge.get_day(), utils::InputType::Test1)
|
||||||
|
.unwrap()
|
||||||
|
.as_mut(),
|
||||||
|
)
|
||||||
|
.unwrap()
|
||||||
|
.to_string();
|
||||||
|
|
||||||
|
assert_eq!(answer, "Ready");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn part2() {
|
||||||
|
let challenge = day14::Day14 {};
|
||||||
|
|
||||||
|
//Complete the Challenge
|
||||||
|
let answer = challenge
|
||||||
|
.part2(
|
||||||
|
utils::get_input(challenge.get_day(), utils::InputType::Test2)
|
||||||
|
.unwrap()
|
||||||
|
.as_mut(),
|
||||||
|
)
|
||||||
|
.unwrap()
|
||||||
|
.to_string();
|
||||||
|
|
||||||
|
assert_eq!(answer, "Ready");
|
||||||
|
}
|
||||||
|
}
|
||||||
66
src/solutions/day15.rs
Normal file
66
src/solutions/day15.rs
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
use super::Solution;
|
||||||
|
|
||||||
|
pub struct Day15 {}
|
||||||
|
|
||||||
|
impl Solution for Day15 {
|
||||||
|
fn part1(
|
||||||
|
&self,
|
||||||
|
_input: &mut Vec<String>,
|
||||||
|
) -> Result<Box<dyn std::fmt::Display>, Box<dyn std::error::Error>> {
|
||||||
|
Ok(Box::new("Ready"))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn part2(
|
||||||
|
&self,
|
||||||
|
_input: &mut Vec<String>,
|
||||||
|
) -> Result<Box<dyn std::fmt::Display>, Box<dyn std::error::Error>> {
|
||||||
|
Ok(Box::new("Ready"))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_day(&self) -> u8 {
|
||||||
|
15
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Day15 {}
|
||||||
|
|
||||||
|
/// Test from puzzle input
|
||||||
|
#[cfg(test)]
|
||||||
|
mod test {
|
||||||
|
use super::*;
|
||||||
|
use crate::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn part1() {
|
||||||
|
let challenge = day15::Day15 {};
|
||||||
|
|
||||||
|
//Complete the Challenge
|
||||||
|
let answer = challenge
|
||||||
|
.part1(
|
||||||
|
utils::get_input(challenge.get_day(), utils::InputType::Test1)
|
||||||
|
.unwrap()
|
||||||
|
.as_mut(),
|
||||||
|
)
|
||||||
|
.unwrap()
|
||||||
|
.to_string();
|
||||||
|
|
||||||
|
assert_eq!(answer, "Ready");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn part2() {
|
||||||
|
let challenge = day15::Day15 {};
|
||||||
|
|
||||||
|
//Complete the Challenge
|
||||||
|
let answer = challenge
|
||||||
|
.part2(
|
||||||
|
utils::get_input(challenge.get_day(), utils::InputType::Test2)
|
||||||
|
.unwrap()
|
||||||
|
.as_mut(),
|
||||||
|
)
|
||||||
|
.unwrap()
|
||||||
|
.to_string();
|
||||||
|
|
||||||
|
assert_eq!(answer, "Ready");
|
||||||
|
}
|
||||||
|
}
|
||||||
66
src/solutions/day16.rs
Normal file
66
src/solutions/day16.rs
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
use super::Solution;
|
||||||
|
|
||||||
|
pub struct Day16 {}
|
||||||
|
|
||||||
|
impl Solution for Day16 {
|
||||||
|
fn part1(
|
||||||
|
&self,
|
||||||
|
_input: &mut Vec<String>,
|
||||||
|
) -> Result<Box<dyn std::fmt::Display>, Box<dyn std::error::Error>> {
|
||||||
|
Ok(Box::new("Ready"))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn part2(
|
||||||
|
&self,
|
||||||
|
_input: &mut Vec<String>,
|
||||||
|
) -> Result<Box<dyn std::fmt::Display>, Box<dyn std::error::Error>> {
|
||||||
|
Ok(Box::new("Ready"))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_day(&self) -> u8 {
|
||||||
|
16
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Day16 {}
|
||||||
|
|
||||||
|
/// Test from puzzle input
|
||||||
|
#[cfg(test)]
|
||||||
|
mod test {
|
||||||
|
use super::*;
|
||||||
|
use crate::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn part1() {
|
||||||
|
let challenge = day16::Day16 {};
|
||||||
|
|
||||||
|
//Complete the Challenge
|
||||||
|
let answer = challenge
|
||||||
|
.part1(
|
||||||
|
utils::get_input(challenge.get_day(), utils::InputType::Test1)
|
||||||
|
.unwrap()
|
||||||
|
.as_mut(),
|
||||||
|
)
|
||||||
|
.unwrap()
|
||||||
|
.to_string();
|
||||||
|
|
||||||
|
assert_eq!(answer, "Ready");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn part2() {
|
||||||
|
let challenge = day16::Day16 {};
|
||||||
|
|
||||||
|
//Complete the Challenge
|
||||||
|
let answer = challenge
|
||||||
|
.part2(
|
||||||
|
utils::get_input(challenge.get_day(), utils::InputType::Test2)
|
||||||
|
.unwrap()
|
||||||
|
.as_mut(),
|
||||||
|
)
|
||||||
|
.unwrap()
|
||||||
|
.to_string();
|
||||||
|
|
||||||
|
assert_eq!(answer, "Ready");
|
||||||
|
}
|
||||||
|
}
|
||||||
66
src/solutions/day17.rs
Normal file
66
src/solutions/day17.rs
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
use super::Solution;
|
||||||
|
|
||||||
|
pub struct Day17 {}
|
||||||
|
|
||||||
|
impl Solution for Day17 {
|
||||||
|
fn part1(
|
||||||
|
&self,
|
||||||
|
_input: &mut Vec<String>,
|
||||||
|
) -> Result<Box<dyn std::fmt::Display>, Box<dyn std::error::Error>> {
|
||||||
|
Ok(Box::new("Ready"))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn part2(
|
||||||
|
&self,
|
||||||
|
_input: &mut Vec<String>,
|
||||||
|
) -> Result<Box<dyn std::fmt::Display>, Box<dyn std::error::Error>> {
|
||||||
|
Ok(Box::new("Ready"))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_day(&self) -> u8 {
|
||||||
|
17
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Day17 {}
|
||||||
|
|
||||||
|
/// Test from puzzle input
|
||||||
|
#[cfg(test)]
|
||||||
|
mod test {
|
||||||
|
use super::*;
|
||||||
|
use crate::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn part1() {
|
||||||
|
let challenge = day17::Day17 {};
|
||||||
|
|
||||||
|
//Complete the Challenge
|
||||||
|
let answer = challenge
|
||||||
|
.part1(
|
||||||
|
utils::get_input(challenge.get_day(), utils::InputType::Test1)
|
||||||
|
.unwrap()
|
||||||
|
.as_mut(),
|
||||||
|
)
|
||||||
|
.unwrap()
|
||||||
|
.to_string();
|
||||||
|
|
||||||
|
assert_eq!(answer, "Ready");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn part2() {
|
||||||
|
let challenge = day17::Day17 {};
|
||||||
|
|
||||||
|
//Complete the Challenge
|
||||||
|
let answer = challenge
|
||||||
|
.part2(
|
||||||
|
utils::get_input(challenge.get_day(), utils::InputType::Test2)
|
||||||
|
.unwrap()
|
||||||
|
.as_mut(),
|
||||||
|
)
|
||||||
|
.unwrap()
|
||||||
|
.to_string();
|
||||||
|
|
||||||
|
assert_eq!(answer, "Ready");
|
||||||
|
}
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user