def schedule_match(self): if len(self.competitors) < 2: return None pairings = itertools.combinations(self.competitors, 2) least_played = min(pairings, key=lambda x: self.data.get_pairing(*x).games) pairing = self.data.get_pairing(*least_played) pairing.games += 1 game = battle.Game(config.host, scheduler.next_game()) match = battle.Match(least_played[0], least_played[1], game) return match
def schedule_match(self): if not self.competitor: self.make_competitor() self.competitor.scheduled += 1 game = battle.Game(config.host, scheduler.next_game()) args = [self.champion, self.competitor] random.shuffle(args) args.append(game) print(args) match = battle.Match(*args) if self.competitor.scheduled >= self.match_count: self.competitor = None return match