Example #1
0
  @Override
  public void onTurnEnded(TurnEndedEvent event) {
    super.onTurnEnded(event);
    IRobotSnapshot gh = event.getTurnSnapshot().getRobots()[1];

    switch (event.getTurnSnapshot().getTurn()) {
      case 1:
        test(gh, "3.0");
        break;

      case 2:
        test(gh, "2.8");
        break;

      case 3:
        test(gh, "2.699999");
        break;

      case 4:
        test(gh, "2.599999");
        break;

      case 9:
        test(gh, "2.09999999");
        break;

      case 20:
        test(gh, "0.9999999");
        break;

      case 28:
        test(gh, "0.19999999");
        break;

      case 29:
        test(gh, "0.09999999");
        break;

      case 30:
        test(gh, "1.6");
        break;

      case 570:
        test(gh, "2.77555");
        break;

      case 571:
        test(gh, "0.0");
        break;

      default:
        break;
    }
  }
  public void onTurnEnded(TurnEndedEvent event) {
    super.onTurnEnded(event);
    final String out = event.getTurnSnapshot().getRobots()[1].getOutputStreamSnapshot();

    if (out.contains("Scanned!!!")) {
      messagedScanned = true;
    }
  }
  @Override
  public void onTurnEnded(TurnEndedEvent event) {
    super.onTurnEnded(event);
    final String out = event.getTurnSnapshot().getRobots()[1].getOutputStreamSnapshot();

    if (out.contains("System.Security.SecurityException")) {
      messaged = true;
    }
  }
  @Override
  public void onTurnEnded(TurnEndedEvent event) {
    super.onTurnEnded(event);
    IRobotSnapshot gh = event.getTurnSnapshot().getRobots()[1];

    switch (event.getTurnSnapshot().getTurn()) {
      case 130:
        test(gh, "130 onTick99\n130 onTick30");
        break;

      case 1451:
        test(gh, "1451 onTick99\n1451 onLowEnergy98\n1451 onTick30\n1451 onScannedRobot10");
        break;

      default:
        break;
    }
  }
  @Override
  public void onTurnEnded(TurnEndedEvent event) {
    super.onTurnEnded(event);
    final String out = event.getTurnSnapshot().getRobots()[0].getOutputStreamSnapshot();

    if (out.contains("You may only create 5 threads")) {
      messagedMax = true;
    }
  }
  public void onTurnEnded(TurnEndedEvent event) {
    super.onTurnEnded(event);
    final String out = event.getTurnSnapshot().getRobots()[1].getOutputStreamSnapshot();

    if (out.contains("Skipped!!!")) {
      messagedEvent = true;
    }
    if (out.contains("not performed any actions in a reasonable")) {
      messagedBattle = true;
    }
  }
  @Override
  public void onTurnEnded(TurnEndedEvent event) {
    super.onTurnEnded(event);
    final String out = event.getTurnSnapshot().getRobots()[0].getOutputStreamSnapshot();

    if (out.contains("You may only create 5 threads")) {
      messagedMax = true;
    }

    if (out.contains("Preventing thread Thread-")
        && out.contains("with unknown thread group MyAttack from access")) {
      messagedUnknown = true;
    }
  }
  @Override
  public void onTurnEnded(TurnEndedEvent event) {
    super.onTurnEnded(event);
    final String out = event.getTurnSnapshot().getRobots()[1].getOutputStreamSnapshot();

    if (out.contains(
        "Preventing tested.robots.FileAttack from access: (java.io.FilePermission C:\\MSDOS.SYS read)")) {
      messagedRead = true;
    }
    if (out.contains(
        "Preventing tested.robots.FileAttack from access: (java.io.FilePermission C:\\Robocode.attack write)")) {
      messagedWrite = true;
    }
  }
Example #9
0
  @Override
  public void onTurnEnded(TurnEndedEvent event) {
    super.onTurnEnded(event);
    lastTurn = event.getTurnSnapshot().getTurn();

    // System.out.println(event.getTurnSnapshot().getTurn());
    IRobotSnapshot crazy = event.getTurnSnapshot().getRobots()[0];
    IRobotSnapshot target = event.getTurnSnapshot().getRobots()[1];

    if (lastTurn == 1) {
      Assert.assertNear(565.4354411, crazy.getX());
      Assert.assertNear(164.5709508, crazy.getY());
      Assert.assertNear(436.3146436, target.getX());
      Assert.assertNear(350.7235444, target.getY());
    }

    if (lastTurn == 1700) {
      Assert.assertNear(38.69810137, crazy.getX());
      Assert.assertNear(214.9945902, crazy.getY());
      Assert.assertNear(339.9178023, target.getX());
      Assert.assertNear(455.7698379, target.getY());
    }
  }
Example #10
0
 @Override
 public void onTurnEnded(TurnEndedEvent event) {
   snapshot.set(event.getTurnSnapshot());
 }
Example #11
0
  @Override
  public void onTurnEnded(TurnEndedEvent event) {
    super.onTurnEnded(event);
    turnNumber = event.getTurnSnapshot().getTurn();

    IRobotSnapshot rate = event.getTurnSnapshot().getRobots()[0];

    // Test turnRate
    if (turnNumber == 10) {
      Assert.assertNear(Math.PI / 4, normalRelativeAngle(rate.getBodyHeading() - originalHeading));
    }
    if (turnNumber == 20) {
      Assert.assertNear(-Math.PI / 4, normalRelativeAngle(rate.getBodyHeading() - originalHeading));
    }
    if (turnNumber == 25) {
      // Test that turnRate was set to zero
      Assert.assertNear(-Math.PI / 4, normalRelativeAngle(rate.getBodyHeading() - originalHeading));

      // Test velocityRate
      double theta = rate.getBodyHeading();
      double deltaX = rate.getX() - originalX;
      double distanceTravelled = deltaX / Math.sin(theta);

      Assert.assertNear(9, distanceTravelled);
    }
    if (turnNumber == 35) {
      double theta = rate.getBodyHeading();
      double deltaX = rate.getX() - originalX;
      double distanceTravelled = deltaX / Math.sin(theta);

      Assert.assertNear(-35, distanceTravelled);
      originalGunHeading = rate.getGunHeading();
    }
    if (turnNumber == 45) {
      // Test that velocityRate was set to zero
      double theta = rate.getBodyHeading();
      double deltaX = rate.getX() - originalX;
      double distanceTravelled = deltaX / Math.sin(theta);

      Assert.assertNear(-47, distanceTravelled);

      // test gunRotationRate
      Assert.assertNear(
          Math.PI / 2, normalRelativeAngle(rate.getGunHeading() - originalGunHeading));
    }
    if (turnNumber == 55) {
      Assert.assertNear(
          Math.PI / 4, normalRelativeAngle(rate.getGunHeading() - originalGunHeading));
      originalRadarHeading = rate.getRadarHeading();
    }

    if (turnNumber == 65) {
      // test that gunRotationRate was set to zero
      Assert.assertNear(
          Math.PI / 4, normalRelativeAngle(rate.getGunHeading() - originalGunHeading));

      // test radarRotationRate
      Assert.assertNear(
          Math.PI / 2, normalRelativeAngle(rate.getRadarHeading() - originalRadarHeading));
    }
    if (turnNumber == 75) {
      Assert.assertNear(
          Math.PI / 4, normalRelativeAngle(rate.getRadarHeading() - originalRadarHeading));
    }
    if (turnNumber == 76) {
      // test that radarRotationRate was set to zero
      Assert.assertNear(
          Math.PI / 4, normalRelativeAngle(rate.getRadarHeading() - originalRadarHeading));
    }
  }