UltraPath.cs 701 B

123456789101112131415161718192021222324252627282930313233
  1. namespace Day17;
  2. public class UltraPath : Path
  3. {
  4. public UltraPath(Path? prev, Tile tile, Vec vRun)
  5. : base(prev, tile, vRun)
  6. {
  7. }
  8. public override IEnumerable<Vec> Next()
  9. {
  10. if (LRun < 4)
  11. {
  12. yield return VRun;
  13. }
  14. else if (LRun < 10)
  15. {
  16. yield return VRun.RotatePositive();
  17. yield return VRun;
  18. yield return VRun.RotateNegative();
  19. }
  20. else
  21. {
  22. yield return VRun.RotatePositive();
  23. yield return VRun.RotateNegative();
  24. }
  25. }
  26. public override bool CanStop()
  27. {
  28. return LRun >= 4;
  29. }
  30. }