cross mix knockout seeds

This commit is contained in:
yohlo
2026-03-01 19:36:26 -06:00
parent c5b3ad50ca
commit 873ca3e4c4
4 changed files with 84 additions and 20 deletions

View File

@@ -37,16 +37,31 @@ export const MatchCard: React.FC<MatchCardProps> = ({
if (!seed || !groupConfig) return undefined;
const groupNames = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H'];
const teamsPerRank = groupConfig.num_groups;
const numGroups = groupConfig.num_groups;
const advancePerGroup = groupConfig.advance_per_group;
const rankIndex = Math.floor((seed - 1) / teamsPerRank);
const groupIndex = (seed - 1) % teamsPerRank;
const pairIndex = Math.floor((seed - 1) / 2);
const isFirstInPair = (seed - 1) % 2 === 0;
const rank = rankIndex + 1;
const groupName = groupNames[groupIndex] || `${groupIndex + 1}`;
const rankSuffix = rank === 1 ? '1st' : rank === 2 ? '2nd' : rank === 3 ? '3rd' : `${rank}th`;
if (isFirstInPair) {
const groupIndex = pairIndex % numGroups;
const rankIndex = Math.floor(pairIndex / numGroups);
return `${groupName} ${rankSuffix}`;
const rank = rankIndex + 1;
const groupName = groupNames[groupIndex] || `${groupIndex + 1}`;
const rankSuffix = rank === 1 ? '1st' : rank === 2 ? '2nd' : rank === 3 ? '3rd' : `${rank}th`;
return `${groupName} ${rankSuffix}`;
} else {
const groupIndex = (pairIndex + 1) % numGroups;
const rankIndex = advancePerGroup - 1 - Math.floor(pairIndex / numGroups);
const rank = rankIndex + 1;
const groupName = groupNames[groupIndex] || `${groupIndex + 1}`;
const rankSuffix = rank === 1 ? '1st' : rank === 2 ? '2nd' : rank === 3 ? '3rd' : `${rank}th`;
return `${groupName} ${rankSuffix}`;
}
}, [groupConfig]);
const homeSlot = useMemo(