namespace Day17; public class Path { public Path? Prev { get; } public Tile Tile { get; } public Vec VRun { get; } public int LRun { get; } public int Cost { get; } public Path(Path? prev, Tile tile, Vec vRun) { Prev = prev; Tile = tile; VRun = vRun; LRun = prev == null ? 0 : vRun == Prev?.VRun ? Prev!.LRun + 1 : 1; Cost = (prev?.Cost ?? 0) + tile.Cost; } public virtual IEnumerable Next() { yield return VRun.RotatePositive(); if (LRun < 3) { yield return VRun; } yield return VRun.RotateNegative(); } public virtual bool CanStop() { return true; } public string GetKey() { return $"{Tile.Position.X}/{Tile.Position.Y},{VRun.X}/{VRun.Y},{LRun}"; } }