eutro / aoc2022

Solutions to Advent of Code in Prolog

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AOC 2022

Run All

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 the inputs directory.
    • Requires session.key in the containing directory, which must contain your session cookie from the Advent of Code website.
  • ./cmp.sh [day]: compile the solution for the given day (or today), outputting to the out directory.
    • This just calls tup for the specified day.
  • ./run.sh [day] [--]: run the solution for the given day.
    • Recompiles by calling cmp.sh.
    • If -- is not provided, fetch input (with fetch.sh) if not yet downloaded.
    • With --, just read input from stdin.

About

Solutions to Advent of Code in Prolog

License:GNU General Public License v3.0


Languages

Language:Prolog 67.3%Language:C 17.7%Language:JavaScript 10.9%Language:Shell 2.6%Language:HTML 0.5%Language:CSS 0.5%Language:Emacs Lisp 0.4%