Skip to content
A cookiecutter template for the Advent of Code challenges
Python
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github/ISSUE_TEMPLATE
advent_of_code
aoc_cookiecutter.egg-info
templates
.gitignore
CODE_OF_CONDUCT.md
CONTRIBUTING.md
LICENSE
README.md
generate.py
requirements.txt
setup.py

README.md

Advent of Code Cookiecutter

Christmas Tree

Photo by Thomas Kelley on Unsplash


This project is intended to bootstrap the Advent of Code challenges a provide quick and easy experience to get up and running with them.

The following utilities have been provided out of the box:

  • Function stubs for each of the challenges.
  • Empty files to drop challenge inputs and solutions into.
  • Unit test stubs for all of the challenges.
  • Helper functions for loading challenge inputs and solutions.

Getting Started

To get up and running, simply fork this repository and clone it to your local development environment.

Next, to get the environment setup run pip install -e . in the root directory of the project containing the setup.py file. This is recomended to be done in a virtual environment.

For each days challenge, get the input from the Advent of Code website and paste it into the corresponding input file in .advent_of_code\data\input directory.

The next step is to implement the code to solve the challenge in the part1() & part2() functions in the corresponding days day_{n}.py file in the .advent_of_code\challenges directory. Output from the implemented solution will be written to file when the days challenges are executed in the day_{n}.py file. Answers are also output to the console so you they can be easily pasted into the Advent of Code website for validation.

Challenges can be executed by simply running the days challenge file. E.g. run python day_1.py in the challenges directory.

Now the answer is available unit tests can be executed against the correct solution to refactor solutions with confidence.


Modifying Generated File Templates

In addition to the out of the box utilites, templates are provided so the generated function and unit test stubs can be modified and regenerated according to the templates. Templates are written using Jinja2.

  1. Install the required dependencies into your Python environment by executing pip install -r requirements.txt in the root directory of the project containing the requiements.txt file.
  2. Modify the generated code modify the provided templates in the .\generate\templates directory as required.
  3. Execute generate.py.

Contributing

Contributions are very welcome and appreciated, Please see the contribution guidelines for for further details.

You can’t perform that action at this time.