示例#1
0
 public Nothing(Level2Client client)
 {
     Action = () =>
     {
         client.Move(0);
         client.Exit();
         return null;
     };
 }
示例#2
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();
 }
示例#3
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);
         }
     }
 }
示例#4
0
 public Rotate(double angle, Level2Client client)
 {
     this.angle = angle;
     Action = () => client.Rotate(angle);
 }
示例#5
0
 public Forward(double distance, Level2Client client)
 {
     this.distance = distance;
     Action = () => client.Move(distance);
 }