mirror of
https://github.com/parnic/advent-of-code-2022.git
synced 2025-06-16 13:40:13 -05:00
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:
@ -218,8 +218,9 @@ internal class Day24 : Day
|
|||||||
}
|
}
|
||||||
|
|
||||||
// queue up all neighbor possibilities
|
// 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 (n == dest)
|
||||||
{
|
{
|
||||||
if (q.steps + 1 < minSteps)
|
if (q.steps + 1 < minSteps)
|
||||||
|
Reference in New Issue
Block a user