This repo has solutions to the Advent of Code online coding problems. It solves all historical problems and will be updated to solve new ones as they are released.
The solutions are written for combined development and execution speed (i.e. to minimize the total time from when I start reading the problem to when I have submitted the correct answer) and are therefore not up to the highest standards of excellence stylistically.
Variable | Purpose |
---|---|
dt |
raw data |
ls |
lines |
l |
line |
ss |
sections |
sm(…) |
submit |
Variable | Purpose |
---|---|
pa(l, pt+) |
pattern match, e.g. pa(l, "valve {} has flow rate={i}") |
gr(ls, fn?) |
gridify lines, optionally postprocessing each character |
cngr(es, tgs) |
condense graph from (edge_map: {T, {T, int}}, targets: [T]) -> {T, {T, int}} |
- Assembly
- Search
- Timer
assembly.py
utility for assembly problemscommon.py
utility for standard importssearch.py
utility for search problemstimer.py
utility for timing a processweb.py
utility for interacting with the websiteprototype
a directory to copy and rename for a new problem[year]
a year[day]
a day of decembersln.py
the solution fileinp.txt
the input from the specific problem; optional if the input data is in solution file
Set the AOC_SESSION
environment variable by following the following steps in Chrome
- Login to AOC online
- Right click > Inspect > Application > Cookies > https://adventofcode.com/
- Copy the value of the session cookie to your environment variable
Run a given solution with
cd ./[year]/[day]
./sln.py
- Update
requirements.txt
- Centralize 100% of imports into
common.py
and replace all imports - Fix TODOs
- Migrate all problems to use
web.py
- Migrate all search problems to use
search.py
- Identify and improve other common patterns
- Translate text like in 2021-13 and elsewhere to a submission