def CreateFakeScoreForMatches(start, end): for i in range(start, end): match = scheduler.match_from_ms(r.lindex("org.srobo.matches", i)) for robot in range(4): WriteScoreForTeam(match["teams"][robot], i, robot, WINNING_SCORES[robot], 0)
def GetTeamZone(tla, match_no): """ returns the zone this team occupied during the given match, -1 if the team wasn't in the match """ match = scheduler.match_from_ms(r.lindex("org.srobo.matches", match_no)) if match == None: print "[sched_finals.GetGameScore.GetTeamZone] Match {0} does not exist - critical error".format(match_no) sys.exit(5) for i in range(len(match["teams"])): if match["teams"][i] == tla: # print tla + " were in zone {0} for match {1}".format(i, match_no) return i # print tla + " didn't play in match {0}".format(match_no) return -1
def GetTopTwoTeamsFromMatch(match_no): """ returns the top two teams from the given match number (index in org.srobo.matches) as a list of TLAS (as strings) """ #print "Getting the top two teams from match: " + str(match_no) matches_len = r.llen("org.srobo.matches") if match_no not in range(matches_len): print """[schedule-finals] FATAL ERROR - somehow GetTopTwoTeamsFromMatch was called with match_no = {0}, which is out of range!""".format(match_no) sys.exit(1) match = scheduler.match_from_ms(r.lindex("org.srobo.matches", match_no)) temp = ResolveDraws(match["teams"], 2, match_no) # print "Done getting top two teams" return temp
def GetTopTwoTeamsFromMatch(match_no): """ returns the top two teams from the given match number (index in org.srobo.matches) as a list of TLAS (as strings) """ # print "Getting the top two teams from match: " + str(match_no) matches_len = r.llen("org.srobo.matches") if match_no not in range(matches_len): print """[schedule-finals] FATAL ERROR - somehow GetTopTwoTeamsFromMatch was called with match_no = {0}, which is out of range!""".format( match_no ) sys.exit(1) match = scheduler.match_from_ms(r.lindex("org.srobo.matches", match_no)) temp = ResolveDraws(match["teams"], 2, match_no) # print "Done getting top two teams" return temp
def GetTeamZone(tla, match_no): """ returns the zone this team occupied during the given match, -1 if the team wasn't in the match """ match = scheduler.match_from_ms(r.lindex("org.srobo.matches", match_no)) if match == None: print "[sched_finals.GetGameScore.GetTeamZone] Match {0} does not exist - critical error".format( match_no) sys.exit(5) for i in range(len(match["teams"])): if match["teams"][i] == tla: #print tla + " were in zone {0} for match {1}".format(i, match_no) return i # print tla + " didn't play in match {0}".format(match_no) return -1