Package net.sf.robocode.roborumble.battlesengine

Examples of net.sf.robocode.roborumble.battlesengine.BattlesRunner


    boolean ratingsdownloaded = false;
    boolean participantsdownloaded;
    String version = null;

    do {
      final BattlesRunner engine = new BattlesRunner(parameters);

      if (version == null) {
        version = engine.getVersion();
      }

      System.out.println("Iteration number " + iterations);

      // Download data from Internet if downloads is YES and it has not been download for two hours
      if (downloads.equals("YES")) {
        BotsDownload download = new BotsDownload(parameters);

        if (runonly.equals("SERVER")) {
          // Download rating files and update ratings downloaded
          System.out.println("Downloading rating files ...");
          ratingsdownloaded = download.downloadRatings();
        }
        if ((System.currentTimeMillis() - lastdownload) > 2 * 3600 * 1000) {
          System.out.println("Downloading participants list ...");
          participantsdownloaded = download.downloadParticipantsList();
          System.out.println("Downloading missing bots ...");
          download.downloadMissingBots();
          download.updateCodeSize();
          // Send the order to the server to remove old participants from the ratings file
          if (ratingsdownloaded && participantsdownloaded) {
            System.out.println("Removing old participants from server ...");
            // Send unwanted participants to the server
            download.notifyServerForOldParticipants();
          }

          lastdownload = System.currentTimeMillis();
        }
      }

      // Create battles file (and delete old ones), and execute battles
      if (executes.equals("YES")) {
        final boolean isMelee = melee.equals("YES");

        boolean ready;
        PrepareBattles battles = new PrepareBattles(parameters);

        if (isMelee) {
          System.out.println("Preparing melee battles list ...");
          ready = battles.createMeleeBattlesList();
        } else {
          final boolean isSmartBattles = ratingsdownloaded && runonly.equals("SERVER");

          if (isSmartBattles) {
            System.out.println("Preparing battles list using smart battles...");
            ready = battles.createSmartBattlesList();
          } else {
            System.out.println("Preparing battles list...");
            ready = battles.createBattlesList();
          }
        }

        // Disable the -DPRARALLEL and -DRANDOMSEED options
        System.setProperty("PARALLEL", "false"); // TODO: Remove when robot thread CPU time can be measured
        System.setProperty("RANDOMSEED", "none"); // In tournaments, robots should not be deterministic!

        // Execute battles
        if (ready) {
          if (isMelee) {
            System.out.println("Executing melee battles ...");
          } else {
            System.out.println("Executing battles ...");
          }

          engine.runBattlesImpl(isMelee);
        }
      }

      // Upload results
      if (uploads.equals("YES") && version != null) {
View Full Code Here

TOP

Related Classes of net.sf.robocode.roborumble.battlesengine.BattlesRunner

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.