Ejemplo n.º 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());
        }
Ejemplo n.º 2
0
        public static void TurnRight(double deg)
        {
            double cdegree = Mathematics.Degree(OwnRobots.CurrentRobot);

            if (cdegree < deg)
            {
                if (Consts.LastCommand != Command.TurnRight)
                {
                    ExploreCommander.TurnRight();
                    Consts.LastCommand = Command.TurnRight;
                }
            }
        }