コード例 #1
0
        public static void Turn(double degree, Command command)
        {
            double currentDegree = Mathematics.Degree(OwnRobots.CurrentRobot);

            if (degree < currentDegree)
            {
                while (degree <= currentDegree)
                {
                    currentDegree = Mathematics.Degree(OwnRobots.CurrentRobot);
                    ExploreCommander.TurnLeft(degree);
                }
            }
            else
            {
                while (degree >= currentDegree)
                {
                    currentDegree = Mathematics.Degree(OwnRobots.CurrentRobot);
                    ExploreCommander.TurnRight(degree);
                }
            }

            ExploreCommander.Stop();
            ExploreCommander.SelectedCommand(command);
            Console.WriteLine(Mathematics.Degree(OwnRobots.CurrentRobot).ToString());
        }
コード例 #2
0
        public static void TurnLeft(double deg)
        {
            double cdegree = Mathematics.Degree(OwnRobots.CurrentRobot);

            if (cdegree > deg)
            {
                if (Consts.LastCommand != Command.TurnLeft)
                {
                    ExploreCommander.TurnLeft();
                    Consts.LastCommand = Command.TurnLeft;
                }
            }
        }