Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swiss replaying matches when no replays is possible (w/ possible solution) #2002

Open
PumaClaws opened this issue Dec 29, 2024 · 1 comment

Comments

@PumaClaws
Copy link

I have encountered an issue during Swiss tournaments where any rounds played after a clear winner is determined will sometimes replay matches, even when it is possible to assign matches in that round so that no one replays.
My most recent example of this is from this tournament: https://sendou.ink/to/891/brackets
Seed 1 and Seed 7 play in both Round 2 and Round 4, even though in Round 4 Seed 1 vs Seed 3 and Seed 7 vs Seed 5 was possible and wouldn't have involved replays.

I think I have worked out where the issue is in the code. I refer to the swiss bracket code found at this path: app/features/tournament-bracket/core/Swiss.ts
With these post-winner rounds, the matchmaking function, matchesByNotPlayedBefore, is sometimes used depending on the results of each round. The function grabs all the previous matches and then grabs all the possible match pairings for the current round, using the function makeRounds, and finds the first set of pairings that won't replay any of those previous matches, if possible. However, I don't think makeRounds actually creates all the possible sets of pairings, just some of them.

The function makeRounds is from https://stackoverflow.com/a/75330079_ (thank you for including the link as a comment btw). There you can see that for six participants it generates these possible sets of pairings:
[
[ [ 5, 0 ], [ 1, 4 ], [ 2, 3 ] ],
[ [ 5, 1 ], [ 2, 0 ], [ 3, 4 ] ],
[ [ 5, 2 ], [ 3, 1 ], [ 4, 0 ] ],
[ [ 5, 3 ], [ 4, 2 ], [ 0, 1 ] ],
[ [ 5, 4 ], [ 0, 3 ], [ 1, 2 ] ]
]
However, it misses a lot of possible sets of pairings such as [ [ 5, 0 ], [ 1, 2 ], [ 3, 4 ] ] or [ [ 5, 1 ] , [ 2, 3 ], [ 4, 0 ] ]. Sometimes this limited generation will cause matchesByNotPlayedBefore to return null when it shouldn't and then allow the system to generate matches with replays.

@Sendouc
Copy link
Owner

Sendouc commented Jan 3, 2025

Thanks for reporting the issue! Need to see what would be the best fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants