UNPKG

expeditaet

Version:
391 lines (324 loc) 15.4 kB
# Advent of Code Python Solutions ## [2023](https://adventofcode.com/2023/) [![2023 Python Progress](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/AlexAegis/advent-of-code/master/.github/badges/python/2023.json)](/solutions/python/year2023/) <!-- markdownlint-disable MD013 --> | Day | Part One | Part Two | | ------ | -------- | -------- | | Day 1 | - | - | | Day 2 | - | - | | Day 3 | - | - | | Day 4 | - | - | | Day 5 | - | - | | Day 6 | - | - | | Day 7 | - | - | | Day 8 | - | - | | Day 9 | - | - | | Day 10 | - | - | | Day 11 | - | - | | Day 12 | - | - | | Day 13 | - | - | | Day 14 | - | - | | Day 15 | - | - | | Day 16 | - | - | | Day 17 | - | - | | Day 18 | - | - | | Day 19 | - | - | | Day 20 | - | - | | Day 21 | - | - | | Day 22 | - | - | | Day 23 | - | - | | Day 24 | - | - | | Day 25 | - | - | <!-- markdownlint-enable MD013 --> ## [2022](https://adventofcode.com/2022/) [![2022 Python Progress](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/AlexAegis/advent-of-code/master/.github/badges/python/2022.json)](/solutions/python/year2022/) <!-- markdownlint-disable MD013 --> | Day | Part One | Part Two | | ------ | -------- | -------- | | Day 1 | - | - | | Day 2 | - | - | | Day 3 | - | - | | Day 4 | - | - | | Day 5 | - | - | | Day 6 | - | - | | Day 7 | - | - | | Day 8 | - | - | | Day 9 | - | - | | Day 10 | - | - | | Day 11 | - | - | | Day 12 | - | - | | Day 13 | - | - | | Day 14 | - | - | | Day 15 | - | - | | Day 16 | - | - | | Day 17 | - | - | | Day 18 | - | - | | Day 19 | - | - | | Day 20 | - | - | | Day 21 | - | - | | Day 22 | - | - | | Day 23 | - | - | | Day 24 | - | - | | Day 25 | - | - | <!-- markdownlint-enable MD013 --> ## [2021](https://adventofcode.com/2021/) [![2021 Python Progress](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/AlexAegis/advent-of-code/master/.github/badges/python/2021.json)](/solutions/python/year2021/) <!-- markdownlint-disable MD013 --> | Day | Part One | Part Two | | ------ | -------- | -------- | | Day 1 | - | - | | Day 2 | - | - | | Day 3 | - | - | | Day 4 | - | - | | Day 5 | - | - | | Day 6 | - | - | | Day 7 | - | - | | Day 8 | - | - | | Day 9 | - | - | | Day 10 | - | - | | Day 11 | - | - | | Day 12 | - | - | | Day 13 | - | - | | Day 14 | - | - | | Day 15 | - | - | | Day 16 | - | - | | Day 17 | - | - | | Day 18 | - | - | | Day 19 | - | - | | Day 20 | - | - | | Day 21 | - | - | | Day 22 | - | - | | Day 23 | - | - | | Day 24 | - | - | | Day 25 | - | - | <!-- markdownlint-enable MD013 --> ## [2020](https://adventofcode.com/2020/) [![2020 Python Progress](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/AlexAegis/advent-of-code/master/.github/badges/python/2020.json)](/solutions/python/year2020/) <!-- markdownlint-disable MD013 --> | Day | Part One | Part Two | | ------ | -------- | -------- | | Day 1 | - | - | | Day 2 | - | - | | Day 3 | - | - | | Day 4 | - | - | | Day 5 | - | - | | Day 6 | - | - | | Day 7 | - | - | | Day 8 | - | - | | Day 9 | - | - | | Day 10 | - | - | | Day 11 | - | - | | Day 12 | - | - | | Day 13 | - | - | | Day 14 | - | - | | Day 15 | - | - | | Day 16 | - | - | | Day 17 | - | - | | Day 18 | - | - | | Day 19 | - | - | | Day 20 | - | - | | Day 21 | - | - | | Day 22 | - | - | | Day 23 | - | - | | Day 24 | - | - | | Day 25 | - | - | <!-- markdownlint-enable MD013 --> ## [2019](https://adventofcode.com/2019/) [![2019 Python Progress](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/AlexAegis/advent-of-code/master/.github/badges/python/2019.json)](/solutions/python/year2019/) <!-- markdownlint-disable MD013 --> | Day | Part One | Part Two | | ------ | -------- | -------- | | Day 1 | - | - | | Day 2 | - | - | | Day 3 | - | - | | Day 4 | - | - | | Day 5 | - | - | | Day 6 | - | - | | Day 7 | - | - | | Day 8 | - | - | | Day 9 | - | - | | Day 10 | - | - | | Day 11 | - | - | | Day 12 | - | - | | Day 13 | - | - | | Day 14 | - | - | | Day 15 | - | - | | Day 16 | - | - | | Day 17 | - | - | | Day 18 | - | - | | Day 19 | - | - | | Day 20 | - | - | | Day 21 | - | - | | Day 22 | - | - | | Day 23 | - | - | | Day 24 | - | - | | Day 25 | - | - | <!-- markdownlint-enable MD013 --> ## [2018](https://adventofcode.com/2018/) [![2018 Python Progress](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/AlexAegis/advent-of-code/master/.github/badges/python/2018.json)](/solutions/python/year2018/) <!-- markdownlint-disable MD013 --> | Day | Part One | Part Two | | ------ | -------- | -------- | | Day 1 | - | - | | Day 2 | - | - | | Day 3 | - | - | | Day 4 | - | - | | Day 5 | - | - | | Day 6 | - | - | | Day 7 | - | - | | Day 8 | - | - | | Day 9 | - | - | | Day 10 | - | - | | Day 11 | - | - | | Day 12 | - | - | | Day 13 | - | - | | Day 14 | - | - | | Day 15 | - | - | | Day 16 | - | - | | Day 17 | - | - | | Day 18 | - | - | | Day 19 | - | - | | Day 20 | - | - | | Day 21 | - | - | | Day 22 | - | - | | Day 23 | - | - | | Day 24 | - | - | | Day 25 | - | - | <!-- markdownlint-enable MD013 --> ## [2017](https://adventofcode.com/2017/) [![2017 Python Progress](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/AlexAegis/advent-of-code/master/.github/badges/python/2017.json)](/solutions/python/year2017/) <!-- markdownlint-disable MD013 --> | Day | Part One | Part Two | | ------ | -------- | -------- | | Day 1 | - | - | | Day 2 | - | - | | Day 3 | - | - | | Day 4 | - | - | | Day 5 | - | - | | Day 6 | - | - | | Day 7 | - | - | | Day 8 | - | - | | Day 9 | - | - | | Day 10 | - | - | | Day 11 | - | - | | Day 12 | - | - | | Day 13 | - | - | | Day 14 | - | - | | Day 15 | - | - | | Day 16 | - | - | | Day 17 | - | - | | Day 18 | - | - | | Day 19 | - | - | | Day 20 | - | - | | Day 21 | - | - | | Day 22 | - | - | | Day 23 | - | - | | Day 24 | - | - | | Day 25 | - | - | <!-- markdownlint-enable MD013 --> ## [2016](https://adventofcode.com/2016/) [![2016 Python Progress](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/AlexAegis/advent-of-code/master/.github/badges/python/2016.json)](/solutions/python/year2016/) <!-- markdownlint-disable MD013 --> | Day | Part One | Part Two | | ------ | -------- | -------- | | Day 1 | - | - | | Day 2 | - | - | | Day 3 | - | - | | Day 4 | - | - | | Day 5 | - | - | | Day 6 | - | - | | Day 7 | - | - | | Day 8 | - | - | | Day 9 | - | - | | Day 10 | - | - | | Day 11 | - | - | | Day 12 | - | - | | Day 13 | - | - | | Day 14 | - | - | | Day 15 | - | - | | Day 16 | - | - | | Day 17 | - | - | | Day 18 | - | - | | Day 19 | - | - | | Day 20 | - | - | | Day 21 | - | - | | Day 22 | - | - | | Day 23 | - | - | | Day 24 | - | - | | Day 25 | - | - | <!-- markdownlint-enable MD013 --> ## [2015](https://adventofcode.com/2015/) [![2015 Python Progress](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/AlexAegis/advent-of-code/master/.github/badges/python/2015.json)](/solutions/python/year2015/) <!-- markdownlint-disable MD013 --> | Day | Part One | Part Two | | ------------------------------------------ | ------------------------------------------------- | -------------------------------------------------- | | [Day 1](/solutions/python/year2015/day01/) | [\~0.1ms](/solutions/python/year2015/day01/p1.py) | [\~0.1ms](/solutions/python/year2015/day01/p2.py) | | [Day 2](/solutions/python/year2015/day02/) | [\~0.1ms](/solutions/python/year2015/day02/p1.py) | [\~0.1ms](/solutions/python/year2015/day02/p2.py) | | [Day 3](/solutions/python/year2015/day03/) | [\~0.1ms](/solutions/python/year2015/day03/p1.py) | [\~0.1ms](/solutions/python/year2015/day03/p2.py) | | [Day 4](/solutions/python/year2015/day04/) | [\~268ms](/solutions/python/year2015/day04/p1.py) | [\~8118ms](/solutions/python/year2015/day04/p2.py) | | Day 5 | - | - | | Day 6 | - | - | | Day 7 | - | - | | Day 8 | - | - | | Day 9 | - | - | | Day 10 | - | - | | Day 11 | - | - | | Day 12 | - | - | | Day 13 | - | - | | Day 14 | - | - | | Day 15 | - | - | | Day 16 | - | - | | Day 17 | - | - | | Day 18 | - | - | | Day 19 | - | - | | Day 20 | - | - | | Day 21 | - | - | | Day 22 | - | - | | Day 23 | - | - | | Day 24 | - | - | | Day 25 | - | - | ## Setup Have `pipenv` installed using `pip` (System packages such as the one in the debian repositories can [cause bugs and are not always up to date](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=945139)) ```sh pip install pipenv ``` Create virtualenv and install dependencies using `pipenv`. > For better integration with VS Code the venv is created inside the project as > the interpreter is already selected in the `settings.json` file ```sh pipenv install -d ``` > If pipenv wants to use the global python version instead of pyenvs, make sure > `PYENV_HOME` is set to `$(pyenv root)`. Otherwise you can just force an > interpreter onto `pyenv` using the `--python` argument. ```sh pipenv install --python "$(command -v python)" ``` Activate the environment: ```sh pipenv shell ``` ### Run single solution The `Current File (Python)` VS Code launch config will run and debug the focused file, and loads the `.env` environment beforehand. You can run manually too from the command line, but don't forget to activate the virtual environment using `pipenv`. ```sh pipenv shell python year2015/day01/p1.py ``` ### Test Full test suite ```sh pipenv run test ``` ### Lint ```sh pipenv run lint ``` ### Notes Refactoring in VS Code doesn't seem to work. It can use the pipenv environment if you select it but it writes it into the `settings.json` with a full local path