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.
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
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
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
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.
-
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. -
Check out the puzzle question:
python -m aoc 3 question
-
Write a test in the the
tests
folder. Run the tests and watch them fail. -
Write a solution in the
aoc2022
folder and import it in the__init__.py
file... I've automated the boring stuff. -
Run the tests again watch them pass..
-
Fetch the puzzle input:
python -m aoc 3 data
-
Check to see if your data folder is populated with some puzzle data. Remember the path, you'll need it for your solution class.
-
Run the
aoc
module and check your answer.
python -m aoc2022 --day 3
- 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
- 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
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!