Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Mazes
- {
- public static class EmptyMazeTask
- {
- public static bool MoveRight(Robot robot, int rightSide)
- {
- for (int i = robot.X; i < rightSide; i++)
- {
- robot.MoveTo(Direction.Right);
- if (robot.Finished) return true;
- }
- return false;
- }
- public static bool MoveLeft(Robot robot, int leftSide)
- {
- for (int i = robot.X; i > leftSide; i--)
- {
- robot.MoveTo(Direction.Left);
- if (robot.Finished) return true;
- }
- return false;
- }
- public static bool MoveDown(Robot robot, int DownSide)
- {
- for (int i = robot.Y; i < DownSide; i++)
- {
- robot.MoveTo(Direction.Down);
- if (robot.Finished) return true;
- }
- return false;
- }
- public static bool MoveUp(Robot robot, int upSide)
- {
- for (int i = robot.Y; i > upSide; i--)
- {
- robot.MoveTo(Direction.Up);
- if (robot.Finished) return true;
- }
- return false;
- }
- public static void MoveOut(Robot robot, int width, int height)
- {
- int rightSide = width - 2, downSide = height - 2;
- MoveRight(robot, rightSide);
- MoveDown(robot, downSide);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement