Multi-year, multi-language solutions for Advent of Code, with a focus on learning and experimentation.
- AoC 2025 - 12 languages, 12 days (in progress)
- AoC 2023 - TypeScript (19/25 days complete)
- AoC 2022 - Haskell (15/25 days complete)
- AoC 2021 - Haskell (1/25 days complete)
- AoC 2016 - 10 languages, 1 day
Required:
- Bazel 7.x or later (or Bazelisk for automatic version management)
- GHC (Haskell compiler) - for Haskell solutions
- Nim compiler - for Nim solutions
Optional:
- just command runner - for convenience commands
- Advent of Code session cookie - for automatic input downloading
Note: All other language toolchains (Go, Rust, TypeScript/Node.js, Kotlin, Julia, Zig, C++, .NET) are automatically managed by Bazel via MODULE.bazel.
-
Clone the repository
-
Add your session cookie (optional, for downloading inputs):
echo "your_session_cookie_here" > .aoc-session
-
Download puzzle inputs (optional):
# Download input for a specific day bazel run //src/aoc-cli:aoc -- download -y 2016 -d 1 -
Build and run solutions:
# Build all solutions bazel build //... # Build a specific solution (all parts) bazel build //src/AoC16/s16e01-rust:all # Run a solution part echo "R2, L3" | bazel run //src/AoC16/s16e01-rust:part1 echo "R8, R4, R4, R8" | bazel run //src/AoC16/s16e01-rust:part2 # Run main verification binary (validates both parts) bazel run //src/AoC16/s16e01-rust:s16e01-rust < input.txt # Run tests bazel test //...
python- Python 3.13typescript- TypeScript with Node.js 25rust- Rust 1.91go- Go 1.25haskell- Haskell (GHC with custom build rules)kotlin- Kotlin JVMnim- Nim (with custom build rules)zig- Zig 0.15cpp- C++ with CMakejulia- Julia 1.11
All templates include Bazel BUILD files for reproducible builds.
# Build everything
bazel build //...
# Build specific year
bazel build //src/AoC23:all
bazel build //src/AoC16/...
# Build specific solution
bazel build //src/AoC16/s16e01-rust:all
bazel build //src/AoC22:aoc22
# Run tests
bazel test //src/AoC16/s16e01-cpp/tests:solution_test
bazel test //templates/rust:all
# Run a solution
bazel run //src/AoC16/s16e01-rust:s16e01-rust < input.txtThe repository includes a custom CLI tool for downloading inputs, building solutions, and running tests:
# Run all solutions for a specific day
bazel run //src/aoc-cli:aoc -- run -y 2016 -d 1
# Run a specific language implementation
bazel run //src/aoc-cli:aoc -- run -y 2016 -d 1 -l rust
# Download puzzle input
bazel run //src/aoc-cli:aoc -- download -y 2016 -d 1
# Show help
bazel run //src/aoc-cli:aoc -- --helpThe CLI automatically:
- Finds all language implementations for a given day
- Builds solutions using Bazel
- Runs both parts and validates results
- Displays execution times and success/failure status
advent-of-code/
├── src/
│ ├── AoC25/ # 2025 solutions (multi-language)
│ ├── AoC23/ # 2023 solutions (TypeScript)
│ ├── AoC22/ # 2022 solutions (Haskell)
│ ├── AoC21/ # 2021 solutions (Haskell)
│ ├── AoC16/ # 2016 solutions (10 languages)
│ └── aoc-cli/ # CLI test runner (Go)
├── templates/ # Language templates for new solutions
├── build/ # Custom Bazel rules (nim.bzl, haskell.bzl)
├── scripts/ # Helper scripts
├── MODULE.bazel # Bazel module configuration
├── BUILD.bazel # Root BUILD file
└── justfile # Command orchestration (optional)
This repository uses Bazel for reproducible builds across all languages:
- Hermetic builds - All dependencies managed by Bazel
- Cross-language support - Unified build system for 10+ languages
- Caching - Fast incremental builds
- Toolchain management - Specific language versions pinned in MODULE.bazel
TypeScript (AoC 2023):
- Uses
aspect_rules_tsandaspect_rules_js - pnpm for dependency management
- 19 days with part1 and part2 binaries
Haskell (AoC 2021, AoC 2022):
- Uses custom
haskell_binaryandhaskell_testmacros (seebuild/haskell.bzl) - Simple builds without external package dependencies
- AoC22: Single executable for all 15 days
- AoC21: Three executables (main, part1, part2)
Rust (AoC 2016):
- Uses
rules_rustwith Cargo - Rust 1.91 toolchain
Julia (AoC 2016):
- Uses
rules_julia - Julia 1.11.2 toolchain
- Proper library and binary rules
Other Languages:
- Go:
rules_gowith gazelle - Python:
rules_pythonwith pip - C++:
rules_ccwith native toolchain - Kotlin:
rules_kotlinwith JVM - Zig:
rules_zig0.15.2 - Nim: Custom
nim_binaryandnim_testmacros (seebuild/nim.bzl)
- Inputs are downloaded on demand and cached locally (gitignored)
- Sample inputs from problem descriptions are checked into git
- All solutions use stdin/stdout for I/O
- Each language may use different approaches for experimentation
This is a personal learning repository, but feel free to:
- Browse solutions for ideas
- Open issues for discussions
- Suggest improvements to the setup
MIT License - see LICENSE file for details.
Happy Advent of Code! 🎄⭐