示例#1
0
 static void RobotMovedToRight(Robot robot, int Width)
 {
     for (int i = 0; i < Width; i++)
     {
         robot.MoveRight();
     }
 }
示例#2
0
        public static void MoveOutFromDiagonalMaze(Robot robot, int width, int height)
        {
            int i = 0;

            if (width > height)
            {
                while (i < width + height - 7)
                {
                    RobotMovedToRight(robot, (width - 2) / (height - 2));
                    i += (width - 2) / (height - 2);
                    if (i >= width + height - 7)
                    {
                        break;
                    }
                    robot.MoveDown();
                    i++;
                }
            }
            else
            {
                while (i < width + height - 7)
                {
                    RobotMovedToDown(robot, (height - 2) / (width - 2));
                    i += (height - 2) / (width - 2);
                    if (i >= width + height - 7)
                    {
                        break;
                    }
                    robot.MoveRight();
                    i++;
                }
            }
        }