Advent of Code 2023 - Day 3

oohhhh, completely missed!! nicely done with the Integer.parse(str)… never thought about splitting numbers vs rest this way

Since this one was pretty much all parsing (again), I made a slightly more robust parser this time
e.g.

defp parse(%{todo: [h | t]} = state) when h in @digits do
  state
  |> add_to_buffer(h)
  |> increment(:x)
  |> Map.put(:todo, t)
  |> parse()
end

Worked well for both parts. Full solution code here on Github

1 Like

+1 for this - it’s my favorite part of AoC.

With “real-world” problems, it usually takes months or years to fully regret an architectural decision - with an AoC problem, all it takes is part 2 :stuck_out_tongue:

4 Likes