Example #1
0
  public Tournament() {

    race = new Race();
    race.setTrack("road", "aalborg");
    race.setTermination(Race.Termination.LAPS, 1);
    race.setStage(Controller.Stage.RACE);
  }
Example #2
0
  public Tournament(String type, String track, int laps) {

    race = new Race();
    race.setTrack(type, track);
    race.setTermination(Race.Termination.LAPS, laps);
    race.setStage(Controller.Stage.RACE);
  }
Example #3
0
  public void run(DefaultDriver[] driversList, boolean withGUI) {

    this.drivers = driversList;
    if (race.size() != 0) race.removeAllCompetitors();

    for (int i = 0; i < driversList.length; i++) {
      race.addCompetitor(driversList[i]);
      race.closeAfterFinish = true;
      System.out.println("Driver " + driversList[i].getDriverName());
    }

    if (withGUI) {
      results = race.runWithGUI();
    } else {
      results = race.run();
    }
  }