Esempio n. 1
0
  public static void main(String[] args) {
    long startTime = System.currentTimeMillis();
    Alphabet.initializeAlphabet(GAME_LANGUAGE);
    Trie.initTrie("dictionary/dsso-1.52_utf8.txt");

    List<GameResult> results = new ArrayList<GameResult>();
    Player player1Type = null;
    Player player2Type = null;
    Board boardType;

    for (int i = 0; i < NR_OF_GAMES; i++) {

      //			System.out.println("Playing game nr " + i);
      boardType = new Board();

      player1Type = new BalancePlayer(boardType);
      player2Type = new HighestBonusRoundPlayer(boardType);

      boolean player1StartsPlaying;

      if (i > (NR_OF_GAMES / 2)) player1StartsPlaying = true;
      else player1StartsPlaying = false;

      GameResult result =
          new GameTests(player1StartsPlaying, player1Type, player2Type, boardType).play();
      results.add(result);
    }
    String player1Name = player1Type.getClass().getSimpleName();
    String player2Name = player2Type.getClass().getSimpleName();
    Date date = Calendar.getInstance().getTime();
    String currentTime = DateFormat.getTimeInstance().format(date);
    String currentDate = DateFormat.getDateInstance().format(date);
    String dateTime = currentDate + "_" + currentTime;
    String fileName =
        player1Type.getName()
            + "_"
            + player2Type.getName()
            + "_"
            + NR_OF_GAMES
            + "_"
            + dateTime
            + ".txt";
    String filePath = player1Name + "_" + player2Name + "/" + NR_OF_GAMES + "/";

    long endTime = System.currentTimeMillis();
    int runTimeSeconds = (int) ((endTime - startTime) / 1000);
    GameTests.printResultsToFile(results, fileName, filePath, runTimeSeconds);
    System.out.println("KLAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAR!");
  }