2024 Day 16: Reindeer Maze

@Max posted some comments here, but that topic is for days 17, 18, and 19, so I figured a new thread was not useless.

I did it both ways using Breadth-First Search. Ada.Containers.*Queues don’t allow you to sort queues, and I have a vague memory that the last time I tried to use a priority queue it was a slow tool, the wrong tool, or both slow and wrong, so I queued elements up using a vector that I then sorted on each iteration. That … slows … things … … down … … … at least in Part 2, but it still gets the job done. I may revisit this at some point to look at Ada’s priority queue at some point.

Rather than fuss over visualizing a solution to Part 1 as a binary image, I fussed over visualizing it as text in an html page, here.

I think all the Queues are synchronized, so by default you were probably adding a lot of overhead when you tried those the last time

I wrote a deque and priority queue specifically for advent of code for this reason. Though I also just generally found the standard queues hard to use.

If you’d like to take a look @cantanima or even copy them I don’t mind. I make no guarantees about their quality but they’ve worked great for my aoc solutions.

Priority queues: spec | body

Deques: spec | body (I’ll be honest this one is a bit quirky with the mod index type. I’ll probably revisit the design at some point, but I ran into a limitation with Ada generics.)

1 Like