GithubHelp home page GithubHelp logo

fwcd / advent-of-code-2023 Goto Github PK

View Code? Open in Web Editor NEW
4.0 2.0 0.0 568 KB

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

License: MIT License

Shell 0.79% Nix 34.93% C 1.67% COBOL 4.79% Python 2.47% LLVM 6.66% Prolog 3.89% Objective-C 3.71% Curry 0.83% Java 4.97% Crystal 1.34% MoonScript 2.49% Brainfuck 3.09% D 1.20% Vala 1.73% Go 2.44% Zig 4.97% PHP 3.70% C++ 5.57% Swift 8.77%
advent-of-code advent-of-code-2023

advent-of-code-2023's Introduction

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:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.