Skip to content

jordyjwilliams/advent_of_code

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Advent of Code

Language (Python) Code style: black Imports: isort

Solutions to the Advent of Code challenges.

Puzzle descriptions have not been shared in this repo. This is per request from the AoC creator and many others over countless threads here.

All problems can be found fully described here as well as previous years.

These solutions are not designed to be the fastest computationally. They are simply the first ones I thought of.

Dependencies

These solutions use Poetry for packaging and dependencies:

poetry install --no-dev
  • numpy
  • sympy

These solutions require versions of Python >= 3.8 and poetry >= 1.2

Development dependencies

poetry install
  • pylint
  • black
  • isort

Poetry scripts

poetry run lint                                     # Runs: pylint
poetry run format                                   # Runs: isort & Black formatting on files
poetry run check_format                             # Checks: Black formatting
poetry run check_isort                              # Checks: isort formatter on files
poetry run python ./YYYY/day_XX/day_XX_solution.py  # Runs: solution for given year/day
poetry run YYYY                                     # Runs: all solutions for given year/day
poetry run all_solutions                            # Runs: all year(s) code solutions

Structure

This repository has the following structure: root/year/day_{x}/

Where each day contains an input.txt and a day_xx_solution.py.

When executed, each solution script prints the answer (and time taken) to each challenge part.

Note

In order for poetry run all_solutions function to work properly the following variables must be preset:

  • PART_1_ANS, PART_2_ANS
  • PART_1_TIME_MS, PART_2_TIME_MS

If these are not, there will be no error (failsafe) rather the day solutions will just not print

TODO

  • Possibly run timing iteratively
  • Possibly graph timing for each day's solutions
  • Add tests