mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-05-23 03:46:28 -05:00
Fix swiss round advancing missing teams
This commit is contained in:
parent
209f3e8dc3
commit
a96af50cdb
|
|
@ -1256,8 +1256,8 @@ class SwissBracket extends Bracket {
|
|||
round?.maps?.type === "PLAY_ALL"
|
||||
? round?.maps?.count
|
||||
: Math.ceil((round?.maps?.count ?? 0) / 2);
|
||||
// preview
|
||||
if (!mapWins) {
|
||||
logger.warn("SwissBracket.currentStandings: mapWins not found");
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -545,27 +545,16 @@ function matchesByNotPlayedBefore(
|
|||
return null;
|
||||
}
|
||||
|
||||
// https://stackoverflow.com/a/75330248
|
||||
// https://stackoverflow.com/a/75330079
|
||||
function makeRounds(n: number) {
|
||||
const sets: Record<number, number>[] = [];
|
||||
const rounds: [number, number][][] = [];
|
||||
|
||||
for (let r = 0; r < n - 1; r++) {
|
||||
sets.push({});
|
||||
rounds.push([]);
|
||||
}
|
||||
|
||||
for (let i = 0; i < n - 1; i++) {
|
||||
for (let j = i + 1; j < n; j++) {
|
||||
for (let r = 0; r < n - 1; r++) {
|
||||
if (!sets[r][i] && !sets[r][j]) {
|
||||
sets[r][i] = sets[r][j] = 1;
|
||||
rounds[r].push([i, j]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
const pairings = [];
|
||||
const max = n - 1;
|
||||
for (let i = 0; i < max; i++) {
|
||||
const pairing = [[max, i]];
|
||||
for (let k = 1; k < n / 2; k++) {
|
||||
pairing.push([(i + k) % max, (max + i - k) % max]);
|
||||
}
|
||||
pairings.push(pairing);
|
||||
}
|
||||
|
||||
return rounds;
|
||||
return pairings;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user