My Advent Of Code solutions written in Python, using a script to download puzzles and input (inspired from gahjelle/advent_of_code).
This script uses the package advent-of-code-data
to download puzzle's data. This requires you having set the environment variable AOC_SESSION
.
You can export it in your current shell, or save it in the folder ~/.config/aocd/token
. See here for more info.
This project uses uv
as dependency and python's version manager. Read the official guide to set it up.
Once you have uv
setup, simply run uv sync
to download all project dependencies (advent-of-code-data and ruff).
Once you have all set up, run download_puzzles.sh
passing the YEAR parameter to download all puzzles for that year.
For example, to download puzzles for year 2023:
./download_puzzles.sh 2023
The script will create a folder 2023 and a subfolder or each day, from 1 to 25, filling them with a code.py file that you can fill with your solution, an example1.py and input.txt with the puzzle's input, and a README.md with a link to the puzzle.
I recommend creating alias to run the code with either the complete input or the small example. For example:
alias aot="uv run python code.py example.txt"
alias aoc="uv run python code.py input.txt"