Solutions to Advent of Code in Python (336⭐):
Day | 2015 | 2016 | 2017 | 2018 | 2019 | 2020 | 2021 | 2022 | 2023 |
---|---|---|---|---|---|---|---|---|---|
1 | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ |
2 | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ |
3 | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ |
4 | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ |
5 | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ |
6 | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | |
7 | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | |
8 | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | |
9 | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | |
10 | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | |
11 | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | |
12 | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | ||
13 | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | ||
14 | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | |||
15 | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | |||
16 | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | |||
17 | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | ||||
18 | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | |||
19 | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | ||||
20 | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | ||||
21 | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | |||||
22 | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | ||||
23 | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | |||||
24 | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | |||||
25 | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐⭐ |
Navigate to the puzzle folder:
$ cd 2015/01_not_quite_lisp/
Run the full solution by specifying puzzle input:
$ python aoc201501.py input.txt
You can also run on example input:
$ python aoc201501.py example*.txt
It's possible to work with individual parts in the REPL:
>>> import pathlib
>>> import aoc201501
>>> puzzle_input = pathlib.Path("input.txt").read_text(encoding="utf-8").strip()
>>> data = aoc201501.parse(puzzle_input)
>>> aoc201501.part1(data)
232
>>> aoc201501.part2(data)
1783
Use copier
to invoke the Python template and set up files for a new solution:
$ copier copy --trust gh:gahjelle/template-aoc-python .
Answer the questions and allow the hook to download your personal input.
Test individual puzzles from within the puzzle folder:
$ cd 2015/01_not_quite_lisp/
$ pytest -v
You can test (and benchmark) all puzzles for their output by running test_all_puzzles.py
:
$ pytest -v test_all_puzzles.py
Finally, you can run all puzzle unit tests by running pytest on the puzzle folders:
$ pytest -v 20*
Follow these steps after solving a puzzle:
-
Store the solution to an output file:
$ python aoc201501.py input.txt > output.py.txt
-
Run benchmarks and add them to the README:
$ pytest test_all_puzzles.py -k 2015 $ cat timings.py.md
-
Update READMEs across all projects:
$ cd .. $ make