Exemplo n.º 1
0
  private int initTeam(String teamName) {
    if (!teamIDs.containsKey(teamName)) {
      teamIDs.put(teamName, teamsSeen);
      Player[] roster = new Player[teamSize];
      for (int i = 0; i < teamSize; i++) // Start counting at 1
      roster[i] = new Player(teamsSeen, i + 1, teamSize);
      rosters.add(roster);
      teamsSeen++;
    }

    return teamIDs.get(teamName);
  }
Exemplo n.º 2
0
  /**
   * Initializes initial class variables
   *
   * @param numPlayers
   */
  private void init(int numPlayers) {
    gamesPlayed = 0;
    teamSize = numPlayers;
    teamIDs = new HashMap<String, Integer>();
    teamIDs.put(name(), id);
    teamsSeen++;

    myRoster = new Player[teamSize];
    for (int i = 0; i < teamSize; i++) myRoster[i] = new Player(id, i + 1, teamSize);

    rosters = new ArrayList<Player[]>();
    rosters.add(myRoster);
    myTeam = new Player[lineupSize];
    opposingTeam = new Player[lineupSize];
    internalCoach = new InternalCoach(teamSize);
    externalCoach = new ExternalCoach();
    players = MAX_TEAMS * numPlayers;
    shotHistory = new Fraction[players][players];
    for (int i = 0; i < players; i++) {
      for (int j = 0; j < players; j++) {
        shotHistory[i][j] = new Fraction(0, 0);
      }
    }

    firstGame = false;
  }