Beispiel #1
0
  /* return 5 players in 1,2,3,4,...,P where P total players */
  public int[] pickTeam(String opponent, int totalPlayers, Game[] history) {
    if (firstGame) init(totalPlayers);

    // sanityCheck();
    gamesPlayed++;

    opponentID = initTeam(opponent);

    if (opponentID == id) {
      currentCoach = internalCoach;
    } else {
      currentCoach = externalCoach;
      if (gamesSeen == 0) {
        for (int i = 0; i < history.length; i++) watchGame(history[i]);
        numTrainingGames = history.length;
        realGame = !realGame;
      } else {
        for (int i = gamesSeen - numTrainingGames; i < history.length - numTrainingGames; i++) {
          Game g = history[i];
          // Don't "watch" past regular season games involving us
          // We keep track of these stats as the game happens
          if (initTeam(g.teamA) == id || initTeam(g.teamB) == id) watchLastRound(g);
          else watchGame(g);
        }
      }
    }

    myTeam = currentCoach.pickTeam(myRoster, teamSize, lineupSize);
    int[] lineup = new int[5];
    for (int i = 0; i < 5; i++) lineup[i] = myTeam[i].id;

    return lineup;
  }