My solutions to the Advent of Code puzzles written in the Clojure programming language. I love solving programming puzzles, and my clojure was getting a little rusty.
Given that, these are just my solutions to the problems. There are likely cleaner, faster or more idiomatic ways to do this in Clojure (if so, please drop me a line and let me know).
The input files needed for these solutions come from the
Advent of Code site and are customized for each user. They
have requested that these input files are not made publicly
available. Therefore I have put my input files in a private repo
named advent_of_code_input and check it out as a sibling of
this repo. However, you can specify the location of this repo with
the -DINPUT_REPO=<some path> command line option to below.
To run the all of the solutions you can use the aoc program:
clj -M -m aoc.coreWhich as noted above requires the input files to be in a sibling repo.
To run just a specific year's solutions:
clj -M -m aoc.core 2020To run only specific days you can use any number YYYY.DD arguments:
clj -M -m aoc.core 2020.3 2024.1In addition to the solutions there are also unit tests for each of the problems
as well as the common code in src/aoc. To run the tests for a given package use:
clj -M:test- The main program to run everything is
src/aoc/core.clj. - Each yearly event's code is located in its own directory
src/aoc20XX. Each day's solution is in the year's directory with the formatsrc/aoc/20XX/dayXX.clj. - Useful supporting utilities live in
src/aoc/util.
The Advent of Code is an awesome event that we can all look forward to each year. If you can, please support Eric's efforts at: