Solutions for Advent of Code 2021 in pure Python 3.9. π No dependencies, no speed hacks: pythonic code with just the standard library. π Well, unless I'm too annoyed by the challenge of the day. π€ͺ
Starting at day 5, the code includes comments on coding patterns and algorithms. π This should keep the code understandable even for people new to Python or not familiar with the specific algorithm. π€
There are no solutions for day 24. π’ It's a nice puzzle but not exactly a coding challenge without diving deep into logical solvers. π€·β
The module is directly executable from the CLI. Daily input data is searched inside ./data/ named dayXY.txt or dayXY_ex.txt for examples.
# run day 3
python3 -m aoc2021 3
# run day 4 with example code
python3 -m aoc2021 4 -e
# run days 1,2,3,4,5
python3 -m aoc2021 1 2 3 4 5
# show available options
python3 -m aoc2021 -h
Use the --data
switch to point to a custom data location.
The module can be installed to allow running it with aocd. This lets you compare its solutions against your own and others.
# install the current directory (this repo) and aocd
pip install . advent-of-code-data
# export your session cookie
export AOC_SESSION=612b7c47656....
# run year 2021 solutions
aoc -y 2021