Advent of Code 2023 is nigh

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
  • advent_of_code_ex

    Advent of Code solutions in Elixir, and a bunch of musings on them.

  • > Test your code as you go. Printing the output of intermediate steps to the console is a great way of catching bugs.

    Honestly, just set up whatever you need to be able to write unit tests in your lang of choice. These problems are _so_ amenable to a piecewise approach driven by tests. I'm not like a big TDD advocate or anything, but these problems are great practice for that style of coding - it's just so damn useful to know each of your small pieces of code work.

    Parameterized tests are amazing for AoC, because you can get a handful of test cases basically for free from the puzzle description. If your code doesn't work once you've got all the samples working, you either have some weird edge case that you didn't consider, or you've got one of the brute-force killer puzzles.

    Even for today's, I wound up with 43 different test cases. The vast majority of those are from the puzzle text, and adding them didn't really make the puzzle take that much longer. (Obviously, if you're optimizing for solve speed, you probably wouldn't bother with this approach, but I'm not).

    https://github.com/epiccoleman/advent_of_code_ex/blob/master...

    Another thing of note is that every puzzle basically operates on a list of strings, so it's pretty easy to genericize certain parts of the work of solving puzzles. I have a script which generates a module for the solution in my repo, with separate functions for each part that receive the input, and a test file that has tests for part 1 and part 2. The tests read the input file and pass it as a list of strings (lines) to the part_1 and part_2 functions, so that all the boilerplate is already done, and I get to just focus on writing the guts of the part_1 and part_2 functions (which usually get broken down into several other functions, which can also be tested individually).

  • advent-of-code

  • I did 2016 in Haskell and 2018 in Rust. Haskell was kind of a pain since I had to do a ton of tail recursion. Rust would be a lot easier since it allows you to be imperative when you need to.

    And I definitely only used a tiny subset of either language because I wanted to get the solution as quickly as possible.

    [1] https://github.com/xdavidliu/advent-of-code/tree/main/2016

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • tanenbaum

    OCaml Advent of Code starter project

  • I built an OCaml starter project for Advent of Code that I've been using. Take a look if you'd like to give OCaml a spin!

    https://github.com/Sixstring982/tanenbaum

  • scryer-prolog

    A modern Prolog implementation written mostly in Rust.

  • the-power-of-prolog

    Introduction to modern Prolog

  • kino_aoc

    A helper for Advent of Code (a smart cell) for Elixir Livebook

  • livebook

    Automate code & data workflows with interactive Elixir notebooks

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
  • fs_playground

    F# Playground

  • Perhaps for some puzzles, but I find this solution to be pretty elegant!

    https://github.com/williamcotton/fs_playground/blob/ffbc57ac...

  • advent-of-code-rust

    🎄Starter template for solving Advent of Code in Rust.

  • If you haven't tried Rust:

    Someone put together a very nice template in Rust that automatically downloads tests, solutions, creates a scaffold for the binaries, etc and submits solutions through CLI. I used this template last year to learn Rust and it got me "up and running" quickly and easily.

    https://github.com/fspoettel/advent-of-code-rust

  • swift-interpreter

    Build an interpreter in Swift

  • I don't get the amount of effort people out into the replacement-strategy, I did perfectly fine without it and the code is about as complex as the examples I've seen.

    https://github.com/codr7/swift-interpreter/blob/main/part10/...

  • AdventOfCode2023

  • I ended up using parser combinator library nom. It's not something I use daily, therefore parsing became a puzzle on its own.

    Nom already has a parser for numbers. However, I didn't find an elegant way to take at most one digit. In the end I used take_while_m_n, and mapped it with u64::from_str().

    Another challenge was absence of something such as find_all, that would repeatedly try to parse beginning from each character and then return all matches. I ended up writing my own combinator.

    https://github.com/drola/AdventOfCode2023/blob/main/src/bin/...

  • adventofcode

    My Advent of code challenges (by woile)

  • Nice! I also ended up using nom, it was quite fun.

    https://github.com/woile/adventofcode/blob/main/2023/day1/sr...

  • adventofcode

    🎅 Repo where anyone can solve puzzles from adventofcode.com (by kolonialno)

  • I disagree on it being "overthinking". I just did it without thinking. Saw that it failed on the "eightwo" case since "two" got replaced first, so just replaced "two" with "two2two" instead, then passed it through solver for part1. To me that's simpler and more naive than correctly writing a search or backwards-forwards regex :)

    My solution in Kotlin https://github.com/kolonialno/adventofcode/commit/686cbebb07...

  • advent2023

    scribblings at advent of code 2023

  • Ah, that's a nice observation about zero, that would have saved me some typing. :-)

    I did the same thing with my actual solution in terms of order (but I went 0, 1, 2, 3), but mostly so I could truncate the matching array to solve part 1. Notably, that was a ret-con of my actual solution to part 1, which I originally did by just mapping the characters through .is_ascii_digit(), but I wanted to consolidate the code a little. I ended up with:

    https://github.com/dave-andersen/advent2023/blob/main/src/ma...

  • regex

    An implementation of regular expressions for Rust. This implementation uses finite automata and guarantees linear time matching on all inputs.

  • I'm not familiar with the AoC problem. You might be able to. But RegexSet doesn't give you match offsets.

    You can drop down to regex-automata, which does let you do multi-regex search and it will tell you which patterns match[1]. The docs have an example of a simple lexer[2]. But... that will only give you non-overlapping matches.

    You can drop down to an even lower level of abstraction and get multi-pattern overlapping matches[3], but it's awkward. The comment there explains that I had initially tried to provide a higher level API for it, but was unsure of what the semantics should be. Getting the starting position in particular is a bit of a wrinkle.

    [1]: https://docs.rs/regex-automata/latest/regex_automata/meta/in...

    [2]: https://docs.rs/regex-automata/latest/regex_automata/meta/st...

    [3]: https://github.com/rust-lang/regex/blob/837fd85e79fac2a4ea64...

  • adventofcode2023

    Advent of Code 2023 solutions in SWI Prolog (by emiruz)

  • A Prolog solution:

    https://github.com/emiruz/adventofcode2023/blob/main/day01/p...

  • advent-of-code

    Discontinued Advent of Code 2022 solutions (by deafpolygon)

  • I solved the 2nd part pretty neatly in javascript today... I'm not a great programmer by any stretch but, maybe someone can take a peek and tell me what I can improve?

    https://github.com/deafpolygon/advent-of-code/blob/main/2023...

  • SaaSHub

    SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives

    SaaSHub logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts