def getNormalizedTeamsPos(playerArray, force_lineups=False): playerOfteam1 = filter(lambda player: player.teamID == 1, playerArray) playerOfteam2 = filter(lambda player: player.teamID == 2, playerArray) # sort in order of importance, will cut the last ones in the list playerOfteam1 = sorted(playerOfteam1, key=lambda player: player.careerScore, reverse=True) playerOfteam2 = sorted(playerOfteam2, key=lambda player: player.careerScore, reverse=True) team1 = Team() team1.setValues(playerOfteam1, force_lineups) team2 = Team() team2.setValues(playerOfteam2, force_lineups) return team1.positionArray, team2.positionArray
def getTeams(playerArray): playerOfteam1 = filter(lambda player: player.teamID == 1, playerArray) playerOfteam2 = filter(lambda player: player.teamID == 2, playerArray) # sort in order of importance, will cut the last ones in the list playerOfteam1 = sorted(playerOfteam1, key=lambda player: player.careerScore, reverse=True) playerOfteam2 = sorted(playerOfteam2, key=lambda player: player.careerScore, reverse=True) team1 = Team() team1.setValues(playerOfteam1) team2 = Team() team2.setValues(playerOfteam2) return team1, team2