
(Yes, this image was generated completely by SQL statements!)
Disclaimer
This article will contain spoilers both on how I solved 2022 Day 17's challenge "Pyroclastic Flow" using SQL, as well as general ideas on how to approach the problem. I recommend trying to solve it yourself first, using your favorite language.
AOC Day 17
Another puzzle featuring elephants! (❤️ ❤️ ❤️). This time, the elephants are involved in a suspiciously familiar game involving falling rocks of various shapes. The rocks get blown by jets as they fall, and the goal is to figure out the height of the final tower of rocks after a certain number of them have fallen.
The litany of SQL/Postgres/other items used to solves this puzzle include:
🦛 Making sequences act as global variables.
🦛 The file_fdw extension, to read text files in from the system.
🦛 Various Unicode characters to enhance our graphics game.
🦛 Functions in plpgsql especially for looping and organization.