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
aoc.pyutility for standard importsassembly.pyutility for assembly problemssearch.pyutility for search problemstimer.pyutility for timing a processweb.pyutility for interacting with the websiteprototypea directory to copy and rename for a new problem[year]a year[day]a day of decembersln.pythe solution fileinp.txtthe 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 the
AOC_SESSIONenvironment variable
Run a given solution with
cd ./[year]/[day]
./sln.py- Simplify imports so root doesn't have to be in PYTHONPATH
- Centralize 100% of imports into
aoc.pyand 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
- Improve types and naming of common stuff