Advent of Code 2024 - Day 14Restroom Redoubt
| Problem statement | Source code | Tags: Grid walkingManual inspection
This problem pays tribute to 2016 day 2 (unimplemented).
Part 1
Not much to say about it...? Just move each robot, wrapping around as needed. (Btw, I'm unhappy with how OCaml, a "functional" language, doesn't even have functions for applying a function n times, or function composition.)
Part 2
A very remarkable problem. I've seen all kinds of approaches on Reddit; the one I enjoyed the most was to save each board as JPEG and see which one compresses the best. I think the intended solution is to detect edges since an actual picture should have a lot of straight, smooth edges. However, I used a hack. I assumed that the input is reverse-constructed from an existing image of the Christmas tree, and this eventual position has no overlapping robots (thanks, Reddit wisdom). Any previous state should have some robots overlapping due to them randomly walking around.
As always, let me appreciate this ASCII art (irrelevant padding cropped):