Added advent of code 2025

This commit is contained in:
Jos van Goor 2025-12-01 21:44:08 +01:00
parent 3ece448fd8
commit 4cbb61569d
11 changed files with 4528 additions and 0 deletions

16
advent_of_code_2025/Cargo.lock generated Normal file
View file

@ -0,0 +1,16 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4
[[package]]
name = "advent_of_code_2025"
version = "0.1.0"
dependencies = [
"paste",
]
[[package]]
name = "paste"
version = "1.0.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"

View file

@ -0,0 +1,7 @@
[package]
name = "advent_of_code_2025"
version = "0.1.0"
edition = "2024"
[dependencies]
paste = "1.0"

View file

@ -0,0 +1,14 @@
binop_separator = "Back"
brace_style = "PreferSameLine"
edition = "2024"
enum_discrim_align_threshold = 120
fn_single_line = false
group_imports = "StdExternalCrate"
imports_granularity = "Module"
indent_style = "Block"
max_width = 160
reorder_impl_items = false
struct_field_align_threshold = 120
unstable_features = true
use_small_heuristics = "Max"
where_single_line = true

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,2 @@
pub mod part1;
pub mod part2;

View file

@ -0,0 +1,4 @@
pub fn solve(input: &str) {
}

View file

@ -0,0 +1,4 @@
pub fn solve(input: &str) {
}

View file

@ -0,0 +1,4 @@
use paste::paste;
mod utility;
solve_day!{1}

View file

@ -0,0 +1,10 @@
use std::fs::read_to_string;
pub fn get_input_string(day: u8) -> String {
read_to_string(format!("src/day{}/input.txt", day)).expect("Failed to read input file.")
}
pub fn get_test_string(day: u8, file: Option<&str>) -> String {
let filename = file.unwrap_or("test.txt");
read_to_string(format!("src/day{}/{}", day, filename)).expect("Failed to read input file.")
}

View file

@ -0,0 +1,6 @@
#![allow(unused)]
mod inputstring;
pub use inputstring::{get_input_string, get_test_string};
mod solveday;

View file

@ -0,0 +1,30 @@
#[macro_export]
macro_rules! solve_day {
($day:literal) => {
paste! {mod [<day $day>];}
pub fn main() {
println!("-- Day {} --", $day);
let input = utility::get_input_string($day);
paste! { [<day $day>] ::part1::solve(&input) };
paste! { [<day $day>] ::part2::solve(&input) };
}
};
($day:literal, $filename:literal) => {
paste! {mod [<day $day>];}
pub fn main() {
println!("-- Day {} --", $day);
let input = utility::get_test_string($day, Some($filename));
paste! { [<day $day>] ::part1::solve(&input) };
paste! { [<day $day>] ::part2::solve(&input) };
}
};
}
#[macro_export]
macro_rules! test_day {
($day:literal) => {
solve_day!($day, "test.txt");
};
}