Double — Elimination Tournament Generator

def report_winner(match_id, winner_id): match = get_match(match_id) match.winner_id = winner_id if match.bracket == "winners": next_match = match.next_match slot = match.next_match_slot # "player1" or "player2" set_player_in_match(next_match, slot, winner_id)

# Build WB tree for r in range(1, len(self.wb)): prev = self.wb[r-1] curr = [] for i in range(0, len(prev), 2): curr.append([None, None]) self.wb[r] = curr double elimination tournament generator

// Winners bracket let round = 0; let curr = []; for (let i = 0; i < padded.length; i += 2) curr.push( p1: padded[i], p2: padded[i+1], round, bracket: 'W' ); let curr = []