Giter Club home page Giter Club logo

aoc2022's Introduction

Advent of Code 2022

Introduction

This repo contains some answers to the advent of code puzzles and support modules.

Get started by executing the following commands to set up your environment.

poetry shell
poetry install

This repo contains three modules and a data dump.

aoc

The aoc module is a CLI tool to view the puzzle question, store/view puzzle data, and submit your answer. You only need to provide the value of your session cookie in a .cookie file in the working directory. If you don't you cannot submit your answers.

Check out the cli tool:

python -m aoc --help

image

aoc2022

The aoc2022 module has been turned into a cli tool to quickly view answers making it easier to submit solutions via the command line. Check it out in the familiar way:

python -m aoc2022 -h

image

tests

This module contains the tests provided by AOC or some I have time to make myself. Run them with the following command:

python -m unittest

data

The data folder contains puzzle input as text files. Puzzle input is required to see if the potential solutions provided in aoc2022 run or not.

Methodology

  1. Get the value of your session cookie by visiting the site and store this value in a .cookie file -- never commit this to version control, it should be gitignored anyway.

  2. Check out the puzzle question:

python -m aoc 3 question

image

  1. Write a test in the the tests folder. Run the tests and watch them fail.

  2. Write a solution in the aoc2022 folder and import it in the __init__.py file... I've automated the boring stuff.

  3. Run the tests again watch them pass..

  4. Fetch the puzzle input:

python -m aoc 3 data
  1. Check to see if your data folder is populated with some puzzle data. Remember the path, you'll need it for your solution class.

  2. Run the aoc module and check your answer.

python -m aoc2022 --day 3

image

  1. If you are happy with what you've got. It's time to submit what you see.
python -m aoc 1 submit <answer> --part 1
  1. Read the response in the terminal. If you've submitted a successful solution, you may now kiss... uh, check out the question again. You will see the second part of the puzzle. If you are done with part two just increment the day. Go back to step 2 and rinse and repeat.
python -m aoc 1 question

Conclusion

Advent of Code rocks and you know it. Code katas typically have you fill in the blanks, maybe write your answer below an already defined method. The same can't be said of these puzzles.

Happy holidays!

aoc2022's People

Contributors

markom-dot avatar

Stargazers

Lobel avatar

Watchers

Kostas Georgiou avatar  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.