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()); }
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; } } }