示例#1
0
文件: Team.java 项目: sac2171/hoop
  /* 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;
  }
示例#2
0
文件: Team.java 项目: sac2171/hoop
  /* get players of opponent team */
  public void opponentTeam(int[] opponentPlayers) {

    // If we got rid of this, we could keep track of internal games as they happen
    if (currentCoach == internalCoach) return;

    Player[] opposingRoster = rosters.get(opponentID);

    for (int i = 0; i < lineupSize; i++) opposingTeam[i] = opposingRoster[opponentPlayers[i] - 1];

    currentCoach.setOpposing(opposingTeam);
  }
示例#3
0
文件: Team.java 项目: sac2171/hoop
 /* pick defenders, use 1,2,3,4,5 for players */
 public int[] pickDefend(
     int yourScore, int opponentScore, int ballHolder, Game.Round previousRound) {
   attacking = false;
   if (previousRound != null && realGame) processRnd(myTeam, opposingTeam, previousRound);
   return currentCoach.pickDefend(yourScore, opponentScore, ballHolder, previousRound);
 }
示例#4
0
文件: Team.java 项目: sac2171/hoop
 /* if 0 then shoot, otherwise pass to 1,2,3,4,5 */
 public int action(int[] defenders) {
   return currentCoach.action(defenders);
 }
示例#5
0
文件: Team.java 项目: sac2171/hoop
 /* return one of 1,2,3,4,5 to pick initial ball holder */
 public int pickAttack(int yourScore, int opponentScore, Game.Round previousRound) {
   attacking = true;
   // before each round process the round before it
   if (previousRound != null && realGame) processRnd(opposingTeam, myTeam, previousRound);
   return currentCoach.pickAttack(yourScore, opponentScore, previousRound);
 }