Skip to content

MarkoM-dot/aoc2022

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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!

About

Advent of Code 2022 with some automation

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages