AOC 2022
These are my solutions to Advent of Code 2022, written in Prolog.
Building
Solutions are written for SWI-Prolog,
and it (the swipl
command) is required to run these solutions. To
run the solution for a day, consult the source file and query tha
main.
goal. This will read the input from current_input
(stdin by
default, or AOC_INPUT
when linked using cmp.sh
/Tup), and output
answers to current_output
(stdout by default). Some days also
require linking against their C source file.
Builds are automated using Tup (and the scripts use it), but I'm sure you can compile things manually too (yeehaw).
Here's what the scripts do:
./fetch.sh [day]
: fetch input for the given day (defaults to today), putting it in theinputs
directory.- Requires
session.key
in the containing directory, which must contain yoursession
cookie from the Advent of Code website.
- Requires
./cmp.sh [day]
: compile the solution for the given day (or today), outputting to theout
directory.- This just calls
tup
for the specified day.
- This just calls
./run.sh [day] [--]
: run the solution for the given day.- Recompiles by calling
cmp.sh
. - If
--
is not provided, fetch input (withfetch.sh
) if not yet downloaded. - With
--
, just read input from stdin.
- Recompiles by calling