Example #1
0
 static void Control(int port)
 {
     var client = new Level2Client();
     client.SensorDataReceived += sensorData => form.ShowMap(sensorData.Map);
     client.Configurate(port, true, RoboMoviesBots.Stand);
     client.Rotate(-90);
     client.Move(100);
     client.Rotate(90);
     client.Move(110);
     for (int i = 0; i < 10; i++)
     {
         client.Rotate(10);
     }
     client.Exit();
 }
Example #2
0
 static void Control(int port, IStrategy strategy)
 {
     var client = new Level2Client();
     client.SensorDataReceived += sensorData => form.ShowMap(sensorData.Map);
     var startInfo = client.Configurate(port, true, RoboMoviesBots.Stand);
     var currentReport = new CVARCReport(startInfo, client, true);
     PrintLocation(startInfo);
     while (true)
     {
         var newAction = strategy.GetNextState(currentReport);
         foreach (var command in newAction.Item1)
         {
             var cvarccommand = command as CVARCLowLevelCommand;
             var newState = cvarccommand.Action();
             if (cvarccommand is Nothing)
                 return;
             currentReport = new CVARCReport(newState, client, true);
         }
     }
 }