Skip to content

fwcd/advent-of-code-2023

Repository files navigation

Advent of Code 2023

Run

My solutions to the Advent of Code 2023, written in 25 different programming languages.

Development

The programs are packaged with Nix, a functional package manager for Linux and macOS that focuses on reproducible builds. This makes it easy to build the programs, both locally and CI, without relying on system packages.

To build one of the days, cd into the corresponding directory and build and/or run the Nix flake. For example, to run day 4, use the following commands:

cd day04
nix run . resources/input.txt

Every day is packaged up to take exactly one command-line argument, the input file, and usually includes the demo input from the exercise too.

Tip

The build environment can be added to the current PATH using nix develop. This is useful to manually run the compiler.

Lessons Learned

  • Visualize the input with GraphViz (day 8, 20, 23, 25)
  • Some puzzles are actually reverse-engineering exercises and rely on undocumented input constraints to be solved efficiently or even feasibly at all (day 8, 20, 23)
  • Take the LCM to solve cycle alignment problems (day 8, 20)
  • Binary counters can elegantly be modeled as chains of flip flop (day 20)
  • Cross products can be surprisingly useful to turn the most nonlinear-looking problems into linear equations (day 24)

Previous Years

My solutions to the previous challenges can be found here:

About

Advent of Code 2023 solutions using a different language for each day

Topics

Resources

License

Stars

Watchers

Forks