Open the context
Choose the project folder and name the files or behavior involved.
Build rounds for two through 32 distinct integer player IDs so every pair meets once. Test odd participant counts with a bye and an unchanged input list, rejecting duplicate or Boolean IDs.
Choose the project folder and name the files or behavior involved.
Describe the input, expected output and boundaries that must stay intact.
Review the proposed edits and any commands before relying on their result.
Compare actual behavior with the expected result. If a check fails, investigate it before applying more changes.
def round_robin(ids):
players = list(ids)
if not 2 <= len(players) <= 32 or any(type(v) is not int or abs(v) > 10**9 for v in players):
raise ValueError("players.range")
if len(set(players)) != len(players):
raise ValueError("players.duplicate")
if len(players) % 2:
players.append(None)
rounds = []
for _ in range(len(players)-1):
pairs = [(players[i], players[-1-i]) for i in range(len(players)//2)
if players[i] is not None and players[-1-i] is not None]
rounds.append(pairs)
players = [players[0], players[-1], *players[1:-1]]
return roundsThe example is a starting point for a real project, not a claim that generated code is already tested. Adjust paths, dependencies and expected behavior to match your application.