Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace Mazes
- {
- public static class PyramidMazeTask
- {
- public static void MoveOut(Robot robot, int width, int height)
- {
- var i = 0;
- while (true)
- {
- MoveToManySteps(robot, i % 2 == 0 ? Direction.Right : Direction.Left, width - 3 - i * 2);
- if (robot.Finished)
- break;
- MoveToManySteps(robot, Direction.Up, 2);
- i++;
- }
- }
- private static void MoveToManySteps(Robot robot, Direction direction, int countSteps)
- {
- for (var i = 0; i < countSteps; i++)
- robot.MoveTo(direction);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment