Added advent of code 2025
This commit is contained in:
parent
3ece448fd8
commit
4cbb61569d
11 changed files with 4528 additions and 0 deletions
16
advent_of_code_2025/Cargo.lock
generated
Normal file
16
advent_of_code_2025/Cargo.lock
generated
Normal 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"
|
||||||
7
advent_of_code_2025/Cargo.toml
Normal file
7
advent_of_code_2025/Cargo.toml
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
[package]
|
||||||
|
name = "advent_of_code_2025"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2024"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
paste = "1.0"
|
||||||
14
advent_of_code_2025/rustfmt.toml
Normal file
14
advent_of_code_2025/rustfmt.toml
Normal 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
|
||||||
4431
advent_of_code_2025/src/day1/input.txt
Normal file
4431
advent_of_code_2025/src/day1/input.txt
Normal file
File diff suppressed because it is too large
Load diff
2
advent_of_code_2025/src/day1/mod.rs
Normal file
2
advent_of_code_2025/src/day1/mod.rs
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
pub mod part1;
|
||||||
|
pub mod part2;
|
||||||
4
advent_of_code_2025/src/day1/part1.rs
Normal file
4
advent_of_code_2025/src/day1/part1.rs
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
|
||||||
|
pub fn solve(input: &str) {
|
||||||
|
|
||||||
|
}
|
||||||
4
advent_of_code_2025/src/day1/part2.rs
Normal file
4
advent_of_code_2025/src/day1/part2.rs
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
|
||||||
|
pub fn solve(input: &str) {
|
||||||
|
|
||||||
|
}
|
||||||
4
advent_of_code_2025/src/main.rs
Normal file
4
advent_of_code_2025/src/main.rs
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
use paste::paste;
|
||||||
|
mod utility;
|
||||||
|
|
||||||
|
solve_day!{1}
|
||||||
10
advent_of_code_2025/src/utility/inputstring.rs
Normal file
10
advent_of_code_2025/src/utility/inputstring.rs
Normal 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.")
|
||||||
|
}
|
||||||
6
advent_of_code_2025/src/utility/mod.rs
Normal file
6
advent_of_code_2025/src/utility/mod.rs
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
#![allow(unused)]
|
||||||
|
|
||||||
|
mod inputstring;
|
||||||
|
pub use inputstring::{get_input_string, get_test_string};
|
||||||
|
|
||||||
|
mod solveday;
|
||||||
30
advent_of_code_2025/src/utility/solveday.rs
Normal file
30
advent_of_code_2025/src/utility/solveday.rs
Normal 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");
|
||||||
|
};
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue