Advertisement
nekotrap

Untitled

Oct 1st, 2020
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. namespace Mazes
  2. {
  3. public static class PyramidMazeTask
  4. {
  5. public static void MoveSide(Robot robot, int step, Direction direction)
  6. {
  7. for (int i = 0; i < step; i++)
  8. robot.MoveTo(direction);
  9. }
  10.  
  11. public static void DoPyramidLoop(Robot robot, int width)
  12. {
  13. MoveSide(robot, width, Direction.Right);
  14. MoveSide(robot, 2, Direction.Up);
  15. MoveSide(robot, width-2, Direction.Left);
  16. if (robot.Finished) return;
  17. MoveSide(robot, 2, Direction.Up);
  18. DoPyramidLoop(robot, width-4);
  19. }
  20.  
  21. public static void MoveOut(Robot robot, int width, int height)
  22. {
  23. while (!robot.Finished)
  24. DoPyramidLoop(robot, width-3);
  25.  
  26. }
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement