March 28, 2025

Solution for Advent of Code 2018 - Day 10: The Stars Align

Link to the puzzle text

Part 1

In this puzzle, we have a list of coordinates and velocities of objects. In each step, the objects move in the direction of their velocity. At some point of time, the positions of the objects when plotted show the answer.
 
We updated the positions in a loop. To find the time when the letter show, we used a heurisitic. The objects first converge all to a single area and then move away again. The letters were only readable when the objects converged, so we calculated the bounding box for all objects. At the time of minmal bounding area, we plotted the positions to get the answer.
 
The reading of the letters could also be automated, but this was not required until now.

Part 2 

In part 2, we should return how long it takes until the answer was shown.

Since we already had a loop to update the positions, we added a loop counter and returned the counter when the bounding box was minimal.

Link to my solutions

No comments:

Post a Comment