Solutions to Advent of Code puzzles.
Many days solved in Python, a good portion of earier years in C++, a pinch of Haskell, and more recently using Rust. All days are written as standalone solutions and can be run independently.
Use poetry to install dependencies from the pyproject.toml.
> poetry install
> cd <path to solution>
> poetry run python day_XX.py
Compile using any reasonably recent C++ compiler, unless otherwise specified:
> cd aoc-20XX/day-XX
> g++ -O3 -o day_XX day_XX.cpp
To run Haskell solutions in a way that ensures any potential extra packages are available, use stack. Once installed, the solutions can be run as stack scripts:
> cd aoc-20XX/day-XX
> stack day_XX.hs
Each rust solution is written as a binary crate, and can be compiled and run using Cargo.
> cd aoc-20XX/day-XX
> cargo run --release
This script will fetch the description and input data for a given day and year. If run without any options, it tries to fetch the current day.
> mkdir aoc-2018 # The folder must exist first.
> python init_day.py --day 25 --year 2018
Your AoC session key must be provided, and by default it is assumed to be the content of a file located in ~/.config/aocd/token
.
To get the session key, open the input file url when logged in to AoC and use the inspector to look for the cookie that was sent with the request.