Giter Site home page Giter Site logo

adventofcode's Introduction

adventofcode

These are my solutions to some Advent of Code challenges. See https://adventofcode.com/ for more information.

My goal is to create concise, yet readable solutions.

Solutions

Solutions are present in the solutions/ folder. Solutions take the form of functions with either the name part_1 or part_2 and take a single argument. The argument must be annotated with either str to get the full input document, or list[str] to get the input document split by line.

Automation

The manage.py script takes care of preparing, executing, testing and submitting solutions.

It is best to first set up advent-code-of-data with appriopriate session cookies to ensure that everything works as intended.

Creation of solution template and test data:

python manage.py [year] [day] create

Testing and executing the script (based on provided test data):

python manage.py [year] [day] run [part_1/part_2]

Submitting the solution (will test the result using the test data first):

python manage.py [year] [day] submit [part_1/part_2]

Testing

Typically, AoC challenges will include a small verification test. Test data is provided in the tests/test_data/ folder in YAML files, e.g.:

- input: test input
  part_1: result for part 1
  part_2: result for part 2

For executing individual challenges, see manage.py above.

Additional tests may be provided in the tests/ folder. You can run this, and all challenge verifications with:

pytest

AoC-data integration

You can also use the integration with advent-code-of-data's aoc command:

pip install .
aoc -y 2023 --no-submit

Note that you must probably reinstall after a solution change.

Linting

You can run black solutions tests manage.py and ruff check ... for linting.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.