~tuxpup/aoc_solutions

my solutions for advent of code 2021
Add jupyter to environment.
Solve day 6 using sympy in a jupyter notebook.
slightly cleaned up day 4 solution

refs

main
browse  log 

clone

read-only
https://git.sr.ht/~tuxpup/aoc_solutions
read/write
git@git.sr.ht:~tuxpup/aoc_solutions

You can also use your local clone with git send-email.

#Advent Of Code Solutions

This repository started life as my python solutions for 2021's advent of code. My plan was to use this to get my python as idiomatic as possible, but I sometimes changed course depending on the size of my timebox for a given day, a whim, impatience, etc. I also wound up filling in some past years that I either hadn't participated in or solved using C++ under some other login mechanism. I haven't caught the urge to find those old solutions in cold storage and add them here.

For 2022, I'm once again abandoning my ambitions of using a new language and sticking to python, so I'm just expanding this repository to include 2022's solutions.

Any original code here is licensed under the MIT License. I probably won't take the time to vet any dependencies' licenses unless I copy them into this tree. In the unlikely event something from here is worth copying, the burden is on the copying party to check the suitability of the licenses for code that isn't mine.

#Usage

After spending some time with rust in 2021, I finally decided to learn to use poetry for my python projects. It behaves a lot like cargo in a good way.

This project uses poetry to manage its virtual environments. Either install it from system repositories or give it its own venv and install it with pip, then put it on your path. Once that's done, from the top level of this repository, run:

bash poetry install

to create a virtual environment with all the necessary libraries.

2022 update: I now like to use pyenv to enable switching between python versions (easily) on a per-project basis. I add poetry to all my pyenv environments when I install them.

If you want to try my solution with your data, the easiest way is to grab your session cookie from a visit to [adventofcode.com] (https://adventofcode.com/) using the inspector in your browser and save it into a top-level file called .env containing the cookie and your preferred data storage location:

dotenv AOC_SESSION=GetYourOwnSessionCookie AOCD_DIR=data

and run using poetry:

bash poetry run aoc-geoff run -y $YEAR -d $DAY

to have the script fetch your input and use it. If you've already got your input saved, you can use

bash poetry run aoc run-geoff -y $YEAR -d $DAY /path/to/saved/input.txt

#Credits

This project uses advent-of-code-ocr, by Benjamin Soyka. It's included in this repository because the version available in PyPi lists an old numpy as a requirement, and I couldn't figure out how to get poetry to consume it from my github fork. It's used under the MIT license, which is included in the package.

It also uses Wim Glenn's excellent advent-of-code-data library to download input and submit solutions more conveniently.