PathEdge.cs 467 B

1234567891011121314151617181920
  1. namespace Day23;
  2. public record PathEdge(PathNode Start, PathNode End, List<Tile> Tiles)
  3. {
  4. private static int _count = 0;
  5. private PathEdge? _inverted;
  6. public int Id { get; private set; } = ++_count;
  7. public PathEdge Invert()
  8. {
  9. if (_inverted == null)
  10. {
  11. _inverted = new PathEdge(End, Start, Enumerable.Reverse(Tiles).ToList()) { _inverted = this };
  12. }
  13. return _inverted;
  14. }
  15. }