I brainfarted and had a hard time trying to understand the instructions. > Incrementing is just like counting with numbers: xx, xy, xz, ya, yb, and so on. Increase the rightmost letter one step; if it was z, it wraps around to a, and repeat with the next letter to the left until one doesn't wrap around. I only managed to understand it by looking at solutions on the subreddit, figuring out the correct behavior: az -> ba, azzz -> baaa, azzzzz -> baaaaa etc. I also sped up the test case containing `ghi` as initial password, by looking for the leftmost invalid I, L or O and increase it, replacing all following chars with `a`. ghijklmn -> ghjaaaaa. |
||
|---|---|---|
| .. | ||
| solutions | ||
| tests | ||
| aoc.py | ||
| README.md | ||
Advent of Code 2021
Solutions for #aoc2020 in Python 3 (3.8+).
Help scripts
Solve all puzzles:
python aoc.py
To bootstrap a new puzzle (creates inputs/<day_no>.txt, solutions/day_<day_no>.py och
tests/test_day_<day_no>.py):
python aoc.py <dag_no> "<puzzle_name>"
Manually copy the puzzle input from https://adventofcode.com and paste it in inputs/<day_no>.txt
to start coding.
Solve separate puzzle (replace XX with the puzzle number):
python -m solutions.day_XX
Run tests (replace XX with the puzzle number):
python -m unittest --locals -v
# or, if `pytest` is preferred:
pytest