pevel

Untitled

Oct 4th, 2022
679
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.70 KB | None | 0 0
  1. namespace Mazes
  2. {
  3.     public static class PyramidMazeTask
  4.     {
  5.         public static void MoveOut(Robot robot, int width, int height)
  6.         {
  7.             var i = 0;
  8.             while (true)
  9.             {
  10.                 MoveToManySteps(robot, i % 2 == 0 ? Direction.Right : Direction.Left, width - 3 - i * 2);
  11.                 if (robot.Finished)
  12.                     break;
  13.                 MoveToManySteps(robot, Direction.Up, 2);
  14.                 i++;
  15.             }
  16.         }
  17.  
  18.         private static void MoveToManySteps(Robot robot, Direction direction, int countSteps)
  19.         {
  20.             for (var i = 0; i < countSteps; i++)
  21.                 robot.MoveTo(direction);
  22.         }
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment