Small improvement to day 24

This is the best I have been able to do so far without making vec2's x/y no longer readonly (and then having to clean up after myself each time I leave this scope, which can happen in 3 places...) and since it's a relatively simple change (doesn't kill the ergonomics too terribly), I'm gonna roll with it for now.

Part 2 110ms -> 75ms. I thought GetOrthogonalNeighbors was as fast as I could make it, but maybe there are better ways to get this same result...
This commit is contained in:
2022-12-24 15:43:33 -06:00
parent b707949bf9
commit f9a50e8b4e

View File

@ -218,8 +218,9 @@ internal class Day24 : Day
}
// queue up all neighbor possibilities
foreach (var n in q.pos.GetOrthogonalNeighbors())
foreach (var dir in ivec2.FOURWAY)
{
var n = q.pos + dir;
if (n == dest)
{
if (q.steps + 1 < minSteps)