Multi-year Advent of Code solutions exploring different programming languages and paradigms.
aoc/
├── 2025/ # Zig solutions
├── 2024/ # C++ solutions
├── 2023/ # Rust solutions
├── 2022/ # OCaml solutions
├── common/ # Shared utilities per language
│ ├── rust/ # Rust common library
│ ├── ocaml/ # OCaml common library
│ └── cpp/ # C++ common library
├── justfile # Root task runner
└── scripts/ # Meta-project utilities
# Run a specific day
just run <year> <day>
# Test with sample input
just test <year> <day>
# Create a new day solution
just new <year> <day>
# Show all available commands
just --list| Year | Language | Build Tool | Paradigm |
|---|---|---|---|
| 2025 | Zig 0.13 | zig | Systems, imperative |
| 2024 | C++17 | g++ | Imperative, OOP |
| 2023 | Rust | Cargo | Systems, functional-ish |
| 2022 | OCaml | Dune/opam | Functional |
Each year explores different strengths:
- Zig: Simplicity, explicit control, fast compile times, comptime
- C++: Performance, low-level control, STL algorithms
- Rust: Memory safety, zero-cost abstractions, strong type system
- OCaml: Pattern matching, immutability, algebraic types
Each year has its own README with detailed setup and workflow:
- 2025 README - Zig setup and memory management
- 2024 README - C++ setup and commands
- 2023 README - Rust workspace structure
- 2022 README - OCaml/Dune configuration
Shared utilities to reduce boilerplate across solutions:
- 2023/common - Rust: CLI parsing, input handling, colored output
- 2022/common - OCaml: File I/O helpers
- 2024/common - C++: Common utilities
# From project root
just run 2023 8 # Run 2023 day 8 with input
just test 2024 1 # Test 2024 day 1 with sample
# From year directory (e.g., cd 2023)
just run 8 # Run day 8
just test 8 2 # Test day 8 part 2# From root
just new 2024 15 # Create day 15 for 2024
# From year directory
just new 15 # Create day 15 for current yearThe new command creates:
- Day directory with template code
- Empty
inputandsamplefiles - Language-specific build configuration
# Build specific day
just 2023/build 8
# Run all Rust tests (2023 workspace)
just test-all
# Run clippy on all Rust code
just check
# Clean build artifacts
just clean 2023 # Clean specific year# Show progress for a year
just progress 2023
# Fetch puzzle input (requires AOC session token)
just fetch 2024 10
# Benchmark a solution
just bench 2023 8
# Generate statistics
just stats- Start new day:
just new 2024 5 - Copy input: Add puzzle input to
2024/5/input - Add sample: Add example from problem to
2024/5/sample_1 - Implement: Edit solution file (
main.cpp,main.rs, ormain.ml) - Test:
just test 2024 5to verify with sample - Run:
just run 2024 5to solve with actual input - Iterate: Refine for part 2
See NEW_YEAR.md for a guide on setting up a new year (2025, etc.).
- Progress Tracking: Visual dashboard of completion status
- Input Fetching: Automatic puzzle input download
- Benchmarking: Performance comparison across solutions
- Stats Generation: Lines of code, completion rates, language metrics
- Cargo.toml - Rust workspace configuration (2023 + common)
- dune-workspace - OCaml workspace configuration (2022)
- justfile - Root task runner, delegates to year-specific justfiles
- .editorconfig - Consistent formatting across editors
- rust-toolchain.toml - Rust version specification
- Just - Task runner
- Git - Version control
- Zig ≥ 0.13.0
- Install:
just 2025/install-toolchainor download from ziglang.org
- g++ with C++17 support
- Install:
just 2024/install-toolchainorbrew install gcc(macOS)
- Rust toolchain (specified in rust-toolchain.toml)
- cargo-nextest:
cargo install cargo-nextest - Install:
just 2023/install-toolchain
- OCaml ≥ 5.3.0
- opam - Package manager
- Dune ≥ 3.17.0
- Install:
just 2022/install-toolchain
For automatic input fetching:
# Store your session cookie
echo "your-session-token" > ~/.config/aoc-session
chmod 600 ~/.config/aoc-sessionGet your session token from browser dev tools when logged into adventofcode.com.
- Language Choice: Pick the language that best fits the problem type
- Parsing heavy? OCaml's pattern matching shines
- Performance critical? C++ or Rust
- Complex state? Rust's type system helps
- Common Libraries: Extract repeated patterns into common libraries
- Templates: Year-specific templates encode common solution structure
- Sample Tests: Always test with sample input before running on actual input
- Incremental: Start simple, refactor as patterns emerge
This is a personal learning project, but feel free to:
- Open issues for bugs or suggestions
- Share interesting alternative solutions
- Suggest additional meta-project tooling
MIT - See LICENSE.md