mirror of
https://github.com/SrIzan10/adventofcode.git
synced 2026-06-06 00:46:56 +00:00
feat: 2025 boilerplate
This commit is contained in:
63
2025/Cargo.lock
generated
63
2025/Cargo.lock
generated
@@ -2,6 +2,69 @@
|
||||
# It is not intended for manual editing.
|
||||
version = 4
|
||||
|
||||
[[package]]
|
||||
name = "aho-corasick"
|
||||
version = "1.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "aoc2025"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"itertools",
|
||||
"regex",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "either"
|
||||
version = "1.15.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719"
|
||||
|
||||
[[package]]
|
||||
name = "itertools"
|
||||
version = "0.14.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285"
|
||||
dependencies = [
|
||||
"either",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.7.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273"
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.12.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
"regex-automata",
|
||||
"regex-syntax",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex-automata"
|
||||
version = "0.4.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
"regex-syntax",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex-syntax"
|
||||
version = "0.8.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58"
|
||||
|
||||
@@ -4,3 +4,5 @@ version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
itertools = "0.14.0"
|
||||
regex = "1.12.2"
|
||||
|
||||
27
2025/README.md
Normal file
27
2025/README.md
Normal file
@@ -0,0 +1,27 @@
|
||||
# Advent of Code 2025 - Rust
|
||||
|
||||
## Daily Workflow
|
||||
|
||||
To add a new day's solution (e.g., Day 2):
|
||||
|
||||
1. **Create the Source File**:
|
||||
- Copy `src/days/day01.rs` to `src/days/day02.rs`.
|
||||
- Update the logic in `part1` and `part2`.
|
||||
|
||||
2. **Register the Module**:
|
||||
- Open `src/days/mod.rs`.
|
||||
- Add `pub mod day02;` at the top.
|
||||
- Add a match arm for the new day:
|
||||
```rust
|
||||
2 => day02::run(),
|
||||
```
|
||||
|
||||
3. **Add Input**:
|
||||
- Create a new file `inputs/day02.txt`.
|
||||
- Paste your puzzle input into it.
|
||||
|
||||
4. **Run**:
|
||||
- Execute the solution with:
|
||||
```bash
|
||||
cargo run 2
|
||||
```
|
||||
1
2025/inputs/day01.txt
Normal file
1
2025/inputs/day01.txt
Normal file
@@ -0,0 +1 @@
|
||||
test input
|
||||
17
2025/src/days/day01.rs
Normal file
17
2025/src/days/day01.rs
Normal file
@@ -0,0 +1,17 @@
|
||||
use crate::utils;
|
||||
|
||||
pub fn run() {
|
||||
let input = utils::read_input(1);
|
||||
println!("Part 1: {}", part1(&input));
|
||||
println!("Part 2: {}", part2(&input));
|
||||
}
|
||||
|
||||
fn part1(_input: &str) -> String {
|
||||
// TODO: Solve part 1
|
||||
"Not implemented".to_string()
|
||||
}
|
||||
|
||||
fn part2(_input: &str) -> String {
|
||||
// TODO: Solve part 2
|
||||
"Not implemented".to_string()
|
||||
}
|
||||
8
2025/src/days/mod.rs
Normal file
8
2025/src/days/mod.rs
Normal file
@@ -0,0 +1,8 @@
|
||||
pub mod day01;
|
||||
|
||||
pub fn run_day(day: u8) {
|
||||
match day {
|
||||
1 => day01::run(),
|
||||
_ => println!("Day {} not implemented yet", day),
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,23 @@
|
||||
mod days;
|
||||
mod utils;
|
||||
|
||||
use std::env;
|
||||
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
let args: Vec<String> = env::args().collect();
|
||||
|
||||
if args.len() < 2 {
|
||||
println!("Usage: cargo run <day>");
|
||||
return;
|
||||
}
|
||||
|
||||
let day: u8 = match args[1].parse() {
|
||||
Ok(d) => d,
|
||||
Err(_) => {
|
||||
println!("Invalid day number");
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
days::run_day(day);
|
||||
}
|
||||
|
||||
6
2025/src/utils.rs
Normal file
6
2025/src/utils.rs
Normal file
@@ -0,0 +1,6 @@
|
||||
use std::fs;
|
||||
|
||||
pub fn read_input(day: u8) -> String {
|
||||
let path = format!("inputs/day{:02}.txt", day);
|
||||
fs::read_to_string(&path).unwrap_or_else(|_| panic!("Could not read file: {}", path))
|
||||
}
|
||||
Reference in New Issue
Block a user