Menu

Zero-Rematch Double Elimination, Berger Round-Robin & Rotating-Partner Sit-Out Algorithms in TypeScript
📰

Zero-Rematch Double Elimination, Berger Round-Robin & Rotating-Partner Sit-Out Algorithms in TypeScript

DEV Community: javascript·haitengli·2 days ago
#f5ohEsiY
#devtojavascript#devto#dev#round#bracket
Long article (941 words) — no AI summary yet.
Reading 0:00
15s threshold

Building a browser-first tournament and court scheduler looks deceptively simple until real-world club edge cases hit: 12 teams showing up for a 16-slot knockout draw, Double Elimination losers colliding with their Round 1 opponent again in Round 2 of the Lower Bracket, or 10 Pickleball / Padel players sharing 2 courts where static laminated charts break down immediately.

Here are the four deterministic TypeScript algorithms we used when engineering the client + Cloudflare Workers engine behind CourtBracket.com .

1. Recursive NCAA/ATP Fold Seeding & First-Round BYEs

To guarantee Seed #1 and Seed #2 sit on opposite halves of a knockout bracket—and Seeds #1..#4 occupy distinct quadrants—expand iteratively from [1, 2] up to B = 2^ceil(log2(N)) by folding each seed s against (layerSize + 1 - s) :

export function buildFoldedSeedOrder ( bracketSize : number ) : number [ ] { let seeds = [ 1 , 2 ] ; while ( seeds . length < bracketSize ) { const nextSize = seeds .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.