Advent of Code 2023

Anyone doing Advent of Code 2023?

It’s a great way to learn or improve your coding skills and I find Observable a great platform for both coding solutions and explaining them. Puzzles are issued daily from December 1st to 25th, gradually getting harder through the month. Many of them lend themselves to some visualization so also a good opportunity to practice Plot, d3, VegaLite etc.

I thought a thread based on this post might be a good place for people to discuss the puzzles as they arise (but beware looking at spoilers if you are still working on a solution).

In case it is of interest, I have several collections containing most of the previous puzzles and some general programming utilities that can be useful for some of puzzles:

3 Likes

Day one was in interesting one. Slightly harder than most opening puzzles from previous years, but good at encouraging careful consideration of edge cases.

Here’s my solution with an attempt to use Observable Plot to show the algorithm:

Day 2 was mostly parsing, but Plot worked well here for showing the coloured dice rolls game by game.

Day 4 was a relatively easy one (part 2 being somewhat easier than a first reading might suggest. Exponential explosion in card numbers was moderated by the sequence of winning numbers reducing to 0 at regular intervals…

Great stuff! I haven’t looked at any of your notebooks, in case I might try myself (though I only give that about a 1/3 chance). But I’ll be watching your progress in this thread! :smiley:

Day 5 was unusually challenging for a puzzle within the first week, but satisfying to find a solution that computes the second part in a few milliseconds.

Day 6 offered an easier puzzle than the previous day, encouraging abstraction skills to compute the result efficiently.

Day 7 was a great puzzle. A twist on a familiar game with scope for a bit of optimisation in part 2. Had fun pushing Plot to show card hands.

1 Like

Day 16: The floor will be lava was a fun one to visualize. Impressed by how ‘unplotlike’ Plot can be made to appear.

Yes day 16 was very fun to make!

Today I completely revamped my solution for day 17 (the shortest-path puzzle), and generalized the problem with an interactive in “part 3”. I’m now quite happy with the charts:

2 Likes

Jo: you’re welcome to join (at least) one of the leaderboards at Advent of Code Leaderboard / Visnu Pitiyanuvath | Observable

Ah - I didn’t know there was an Observable one - thanks. Now joined.

I’ve just finished :cold_sweat:. My notebooks are often a complete mess full of broken cells and partial computes. This makes me even more in awe of the series you have published, so clean and polished (and fast). Thanks for sharing!