Exemple #1
0
  public static void main(String[] args) throws IOException {
    IdeArguments ideArguments = IdeArguments.parse(args);
    Main main = new Main(ideArguments.getFileStorage());

    ServiceProvider serviceProvider =
        new DefaultServiceProvider(
            ideArguments,
            main.reportFolder,
            main.taskResultsStorage,
            main.scheduledExecutorService);
    main.initWebServer(serviceProvider, ideArguments);
  }
 @Override
 protected void tearDown() throws Exception {
   super.tearDown();
   framework.stop();
   IO.delete(tmp);
   Main.stop();
   IO.delete(IO.getFile("generated/cache"));
   IO.delete(IO.getFile("generated/storage"));
   framework.waitForStop(100000);
   super.tearDown();
 }
  public static void main(String... args) {
    Main point = new Main(0, 0);

    new Thread(
            () -> {
              for (int i = 0; i < 20; i++) {
                int x = point.getX();
                int y = point.getY();
                if (x != y) {
                  System.err.printf("O_o %d %d \n", x, y);
                }
              }
            })
        .start();

    for (int i = 0; i < 2_000; i++) {
      for (int j = 0; j < 100; j++) {
        point.setX(j);
        point.setY(j);
      }
    }
  }
Exemple #4
0
  public static void main(String[] args) throws Exception {
    long t0 = System.currentTimeMillis();

    final String OPT_JAR_FILE = "aijar";
    final String OPT_CLASSNAME = "ainame";

    Options options =
        new Options()
            .addOption(
                Option.builder(OPT_JAR_FILE)
                    .hasArg()
                    .argName("jarfile")
                    .required()
                    .desc("The path to the jar file")
                    .build())
            .addOption(
                Option.builder(OPT_CLASSNAME)
                    .hasArg()
                    .argName("classname")
                    .required()
                    .desc("The full classpath of the Ai class")
                    .build())
            .addOption(timeOpt);
    DraughtStateParser.addOptions(options);
    HelpFormatter formatter = new HelpFormatter();
    CommandLine line = new DefaultParser().parse(options, args);

    DraughtsPlayer player;
    Integer time;
    DraughtsState draughtsState;
    try {
      File aiJar = new File(line.getOptionValue(OPT_JAR_FILE));
      if (!aiJar.canRead() || !aiJar.isFile()) {
        throw new ParseException("Could not read from aijar");
      }
      String className = line.getOptionValue(OPT_CLASSNAME);
      player = Main.getFromClass(aiJar, className);
      time = Integer.parseInt(line.getOptionValue(OPT_TIME));
      draughtsState = DraughtStateParser.parseDraughtsState(line);
    } catch (JSONException e) {
      formatter.printHelp("java -jar wtcl.jar", options);
      System.err.println(
          "JSON Exception on string " + line.getOptionValue(DraughtStateParser.OPT_BOARD));
      throw e;
    } catch (Exception e) {
      formatter.printHelp("java -jar wtcl.jar", options);
      throw e;
    }
    execute(player, draughtsState, time, t0);
  }