Skip to content

Latest commit

 

History

History
45 lines (35 loc) · 1.76 KB

README.md

File metadata and controls

45 lines (35 loc) · 1.76 KB

Advent of Code

My scripts for Advent of Code.

These scripts are written in Python 3, and some of them use syntax introduced in Python 3.8 (the "walrus operator") and 3.10 (Structural Pattern Matching). If you do not have Python 3.10 available and would like to run these scripts, you have a couple options:

  1. Use the official Docker images for Python. For example, from the root of this git repository, run the following command:

    docker run --rm -it -v $PWD:/scripts python:3.10-slim bash

    This will give you a bash shell, from which you can cd to the bind-mounted scripts dir and run the scripts:

    cd /scripts/2022
    ./day01.py

    When done, exit from the shell (run exit or use Ctrl-d) and the container will be destroyed.

  2. Use pyenv to build a Python 3.10 (or newer) release. This will also require that you have installed the build dependencies.

INPUTS

You must provide your own inputs. Per the FAQ, inputs should not be publicly shared. In my repo, I solve this by storing my inputs in a git submodule which is a separate, private repo. To run these scripts with your own inputs, you must copy them into your clone of this repo at the following path: inputs/YYYY/dayDD.txt, where YYYY is the 4-digit year, and DD is the two-digit date. So, for example, 2022 day 7 would be inputs/2022/day07.txt.