↓ Skip to main content

Advent of Code 2025

·2 mins

I completed Advent of Code again this year, using Kotlin once more. I’d failed to read the full details on the first day and had to have it pointed out to me that there would only be 12 days this year. There was a massive sigh of relief, not least from the rest of my family!

The first eight days all went very smoothly. I was able to get both parts completed in half an hour or less before starting work in the morning. There was even time to tidy up the code a bit so I could push it to GitHub on the same day.

Everything fell apart a bit for Part 2 on Day 9. I was overly concerned about the scenario where the rectangular areas ran along the edges of the larger shape. In the end, it was sufficient to check whether any edge of the shape intersected the rectangle.

Day 10 was the first and only day that I had to pull in another dependency. I used Microsoft Z3 to determine the required button presses given the constraints in Part 2. I wish I could say I hadn’t wasted a lot of time trying alternative solutions first.

On Day 11, I cracked and resorted to using Copilot to help create the solution for Part 2. I had worked out that the minimum state I needed to track was the number of paths containing either of the special devices. It was Copilot’s idea to use a bitmask to store that information efficiently. It also provided the algorithm for the device topology sort, so they didn’t need to be revisited during the search.

Copilot aided again in the solution for Part 2 on the final day, providing most of what you see in canFit. When looking at the solution thread before writing this, I was somewhat dismayed to discover that it wasn’t necessary to attempt to place the presents at all - just checking whether there was enough space under the tree would have sufficed. My solution runs in around 45 seconds, but I’m now left wondering whether the heuristic used to select the type of present would hold up under a more complex topology.

All in all, I enjoyed this year’s challenges, but I am glad to be able to resume my morning walks before work for the remainder of December!

Related

MapRun Score Optimal Route Planning

·4 mins
I decided to test out Copilot on another MapRun-related challenge: planning the optimal route for a score event. Our Summer League events are, more often than not, planned using OpenOrienteeringMap. This uses OpenStreetMap data for the base map. The format is usually a 45-minute urban score event, using MapRun’s ScoreNxx scoring system. The aim was to take the KML file that describes an event, and determine the best route to take to maximise the score. As a constraint, I would specify the maximum distance that the route should cover (i.e., how fast the competitor was expected to run).

MapRun League Results Generator

·2 mins
Southampton Orienteering Club has what is now an annual MapRun league. A few years ago, I wrote a tool to scrape the results for each event, allocate points (only your first attempt counts, and it must be in a specific time window), and publish some HTML results. For example, those from this year (which I might just happen to have won!). For some reason lost in the mists of time, it was written in Node, but I decided that I would rewrite it in Golang before sharing it with the world on GitHub.

Stopping the Git CredentialHelperSelector from popping up

·1 min
Recently, I was plagued by the “CredentialHelperSelector” dialogue popping up multiple times when attempting to pull from a remote Git repository. This was despite repeatedly selecting the option to remember my selection to use manager and various attempts to explicitly set the config helper via the command line.