示例#1
0
 public override void Initialize(Competitions competitions)
 {
     base.Initialize(competitions);
     Map = Competitions.GetSensorsData<PositionSensorsData>(ControlledRobot).BuildMap();
     RobotLocator = new RobotLocator(Map);
     enumerator = currentCommands.GetEnumerator();
 }
示例#2
0
        private static void Main(string[] args)
        {
            var server = new CvarcClient(args, Settings).GetServer<PositionSensorsData>();
            var sensorData = server.Run().SensorsData;
            var map = sensorData.BuildMap();
            var robotLocator = new RobotLocator(map);
            var path = PathSearcher.FindPath(map, map.GetDiscretePosition(map.CurrentPosition), new Point(2, 1));//(2, 1) - just random point

            foreach (var direction in path)
            {
                foreach (var command in robotLocator.GetCommandsByDirection(direction))
                {
                    sensorData = server.SendCommand(command);
                    robotLocator.Update(sensorData);
                }
            }
            server.SendCommand(new Command { Action = CommandAction.WaitForExit });
        }