Heavily cribbed from https://github.com/encse/adventofcode/blob/master/2021/Day15/Solution.cs but transformed to be more my style. At its core, this is just "implement Dijkstra", so I feel no shame in using an existing implementation of a known algorithm. :)