Giter VIP home page Giter VIP logo

advent-of-code-2021's Introduction

Advent of Code 2021

These are Evan Sultanik’s solutions to the 2021 Advent of Code challenges.

This year I tried to write as performant solutions as possible (to the extent that that is possible in Python), all the while making the code as readable and self-documenting as possible.

Running the Code

$ https://github.com/ESultanik/advent-of-code-2021.git
$ cd advent-of-code-2021 
$ pip3 install -e .
$ aoc2021 --help

You can use the aoc2021 program to run each challenge by name or day.

You can also run all of the solved challenges on Evan’s personally assigned inputs by running

$ pip3 install pytest
$ pytest .

Using the Framework

This repo contains a custom framework for quickly implementing solutions to Advent of Code challenges in Python. To reuse it:

from aoc2021 import Challenge

class YourChallenge(Challenge):
    day = 1337  # the day number for the challenge

    @Challenge.register_part(0)
    def first_part(self):
        with open(self.input_path, "r") as f:
            print(f"Input file contents: {f.read()}")
        self.output.write("The solution goes here")

This challenge will automatically be registered, become available from the aoc2021 CLI, and be run with the unit tests. The unit tests will automatically run it against inputs/day1337.txt and save the output to outputs/day1337part0.txt

License

Copyright ©2021, Evan Sultanik. This code is licensed and distributed under the AGPLv3 license.

advent-of-code-2021's People

Contributors

esultanik avatar

Watchers

 avatar  avatar

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.