• Stars
    star
    147
  • Rank 251,347 (Top 5 %)
  • Language
    Jupyter Notebook
  • License
    MIT License
  • Created almost 7 years ago
  • Updated 7 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Advent of Code solutions 2015-2023

Advent of code solutions

Author: Martijn Pieters
Twitter: @zopatista
GitHub: mjpieters

These are my Advent of Code (AoC) puzzle solutions.

Most recent solutions use Python 3.11, and are presented in Jupyter notebooks for easy viewing on GitHub or the online Jupyter notebook viewer.

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.

Running locally

Everything here is run through Jupyter notebooks. If you check out this repository locally everything is included to recreate my environment.

I use Pipenv to manage dependencies, make sure you have 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 the Quit 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.

Additional dependencies

  • Animations are produced using matplotlib's animation API, which requires ffmpeg to be installed. On Mac OS X just use brew install ffmpeg.

  • Graphs are plotted using graphviz command-line tools such as dot, neato, and tred. On Mac OS X, just use brew install graphviz.

Puzzle input data

I use Wim Glenn's advent-of-code-data package to load data directly from the AoC website. This library requires your AoC session cookie. You'll have create your own Advent of Code account, then use your browser development tools to retrieve the session cookie value. Store the value according to the advent-of-code-data instructions (either in ~/.config/aocd/token or in the AOC_SESSION environment variable).

Since this project uses Pipenv, I store it 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.

2015 and 2016 solutions

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 the advent-of-code-data library either so you need to download inputs manually for these.

They are included purely for completion's sake.

Rust solutions

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 the cargo-aoc project as the runner; you'll need to run cargo 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 inputs cargo aoc input -y <year> -d <day> and you can run the solution for that day with cargo aoc -d <day>.

Like with my Python solutions, I did not include my own puzzle inputs in the repository.

License

See the LICENSE file in the same directory.


More Repositories

1

aiolimiter

An efficient implementation of a rate limiter for asyncio.
Python
479
star
2

RummikubConsole

Rummikub solver console with multi-game support and persistence.
Python
19
star
3

rtfunicode

Encoder for unicode to RTF 1.5 command sequences
Python
18
star
4

collective.transmogrifier

A configurable pipeline, aimed at transforming content for import and export
Python
14
star
5

formatflowed

RFC 3676 format=flowed text processing
Python
6
star
6

setuptools_subversion

Setuptools revision control system plugin for Subversion
Python
5
star
7

plone.app.celery

Cerely integration for Plone
Python
4
star
8

SO-userscripts

User scripts for use on Stack Exchange websites
TypeScript
3
star
9

mjpieters.github.com

Personal homepage, GitHub style
JavaScript
3
star
10

quodlibet_plugins

Python
3
star
11

rod.recipe.rabbitmq

Git-svn mirror of rod.recipe.rabbitmq from http://code.google.com/p/rodrecipes
Python
2
star
12

pixiedust

Python interpreter for the PixieDust esoteric language
Python
2
star
13

plone.app.archive

Archive Plone content
Python
2
star
14

plone.app.transmogrifier

This package contains several blueprints for collective.transmogrifier pipelines, commonly used to import content into a Plone site.
Python
2
star
15

collegial

Framework for building sane asyncio applications
Python
1
star
16

collective.captcha

Stateless captcha generation and verification
Python
1
star
17

homebrew-tap

Personal homebrew tap for things I need building.
Ruby
1
star
18

plone.logcontrol

Fine-grained logging adjustment in a running Zope or Plone server.
1
star
19

plone.app.async

Integration package for zc.async allowing asynchronous operations in Plone.
Python
1
star
20

experimental.btree

C
1
star
21

act-container

Docker container to run GitHub actions locally with act
Dockerfile
1
star
22

experimental.catalogqueryplan

C
1
star