- Notifications
You must be signed in to change notification settings - Fork15
Advent of Code solutions 2015-2023
License
mjpieters/adventofcode
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Author:Martijn Pieters
Twitter:@zopatista
GitHub:mjpieters
These are myAdvent of Code (AoC) puzzle solutions.
Most recent solutions usePython 3.12, and are presented inJupyter notebooks for easyviewing on GitHub or theonline Jupyter notebook viewer. The latter is the better viewer, especially as Github's notebook rendered often breaks or at the very least filters out a lot of the interesting bits like animations.
I don't aim to be first on any leaderboard. I aim to have fun solving the coding puzzles and playing with the concepts, and I try to include explanations of my thinking in the notebooks. Sometimes that means I'll include an animation or graph to show off some aspect of the puzzle.
Everything here is run through Jupyter notebooks. If you check out this repository locally everything is included to recreate my environment.
I usePipenv to manage dependencies, make sure youhave it installed before continuing. Once installed, run
$ pipenv install$ ./start
and the jupyter notebook interface is automatically opened in your default browser. You can stop the server with theQuit button in the web interface, or with the./stop
script.
Everything is organised in per-year folders. I tend to update all the libraries and Python release each year, but I don't test if these updates caused issues with solutions for preceding years. If something broke, so be it.
Animations are produced usingmatplotlib's animation API, which requiresffmpeg to be installed. On Mac OS X just use
brew install ffmpeg
.Graphs are plotted usinggraphviz command-line tools such as
dot
,neato
, andtred
. On Mac OS X, just usebrew install graphviz
.
I use Wim Glenn'sadvent-of-code-data
package to load data directly from the AoC website. This library requires your AoC session cookie. You'll have create your ownAdvent of Code account, then use your browser development tools to retrieve the session cookie value. Store the value according to theadvent-of-code-data
instructions (either in~/.config/aocd/token
or in theAOC_SESSION
environment variable).
Since this project uses poetry, I usepoetry-dotenv-plugin and I store the session cookie in a.env
file in the root directory of this project:
AOC_SESSION=deadbeafdeadbeafdeadbeafdeadbeafdeadbeafdeadbeafdeadbeafdeadbeaf
Do make sure to restart the jupyter notebook server after updating this file.
The 2015 and 2016 solutions are not IPython notebooks; they pre-date this repository, but were added later, and have not been updated or tested to work still. These don't use theadvent-of-code-data
library either so you need to download inputs manually for these.
They are included purely for completion's sake.
I'm trying out implementing solutions in Rust as well. I can't promise I'm going to keep this up or that I'll implement Rust versions of all solutions.
I'm using thecargo-aoc project as the runner; you'll need to runcargo install cargo-aoc
to install it. Then, set your AoC credentials (cargo aoc credentials -p ...
), move your working directory to a specific year (cd rust/<year>
, fetch inputscargo aoc input -y <year> -d <day>
and you can run the solution for that day withcargo aoc -d <day>
.
Like with my Python solutions, I did not include my own puzzle inputs in the repository.
See theLICENSE file in the same directory.
About
Advent of Code solutions 2015-2023
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Uh oh!
There was an error while loading.Please reload this page.
Contributors2
Uh oh!
There was an error while loading.Please reload this page.