MCPcopy Create free account
hub / github.com/battlecode/battlecode-2018 / index_team_info

Function index_team_info

scripts/tournament_serialize.py:46–62  ·  view source on GitHub ↗

Fill in TEAM_ID_TO_NAME and TEAM_ID_TO_AVATAR with the information of all teams that have submitted a robot.

(cur)

Source from the content-addressed store, hash-verified

44DEFAULT_AVATAR = AVATAR_PREFIX + 'default.png'
45
46def index_team_info(cur) -> None:
47 '''
48 Fill in TEAM_ID_TO_NAME and TEAM_ID_TO_AVATAR with the information of all
49 teams that have submitted a robot.
50 '''
51 query = 'SELECT DISTINCT teams.id, teams.name, teams.avatar \
52 FROM battlecode_teams teams INNER JOIN scrimmage_submissions subs \
53 ON teams.id = subs.team;'
54 cur.execute(query);
55
56 teams = cur.fetchall()
57 for team_id, name, avatar in teams:
58 TEAM_ID_TO_NAME[team_id] = name
59 if avatar is None:
60 TEAM_ID_TO_AVATAR[team_id] = DEFAULT_AVATAR
61 else:
62 TEAM_ID_TO_AVATAR[team_id] = AVATAR_PREFIX + re.search('/(\d+\..+)$', avatar).group(1)
63
64
65def serialize_team(team_id):

Callers 1

serialize_tournamentFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected