Skip to content

Latest commit

 

History

History
46 lines (30 loc) · 2.05 KB

README.md

File metadata and controls

46 lines (30 loc) · 2.05 KB

Advent of Code

Advent of Code is an advent calendar of small programming puzzles for a variety of skill sets and skill levels that can be solved in any programming language.

This Python application contains algorithms to solve the challenges of Advent of Code 2020, 2021 and 2022. Additionally, there are unit tests to test the validity of the solutions and the performance of each algorithm.

Getting Started

Follow the steps below to get started:

  1. Install python (>=3.8)
  2. Install dependencies: pip install -r requirements.txt
  3. Set the environment variable SESSION_COOKIE to the cookie from the website (after logging in).

Usage

To execute an algorithm for a specific challenge, either run the corresponding file in the challenges folder or run the script run.py in the root of the project:

usage: run.py [-h] [-y YEAR] [-d DAY]

optional arguments:
  -h, --help            show this help message and exit
  -y YEAR, --year YEAR
  -d DAY, --day DAY

Code Quality

Testing validity

Using pytest in combination with its parametrize feature and unittest's mock library, each algorithm is given an example (as given on the website for the specific problem) and checks if the expected output is returned.

Measuring performance

With a similar testing framework as described in the previous section, each algorithm is executed given the actual inputs from the website and are checked whether they finish in a reasonable amount of time. On my private laptop with decent specifications all challenges finish in approximately half a minute.