Skip to content

feat(tournament): double-elimination bracket with Winners/Losers/Grand Finals - #1165

Merged
chinweobtagaz merged 1 commit into
OpenKnight-Foundation:mainfrom
Samaro1:feature/double-elimination-bracket
Aug 28, 2026
Merged

feat(tournament): double-elimination bracket with Winners/Losers/Grand Finals#1165
chinweobtagaz merged 1 commit into
OpenKnight-Foundation:mainfrom
Samaro1:feature/double-elimination-bracket

Conversation

@Samaro1

@Samaro1 Samaro1 commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Summary

Implements full Double-Elimination bracket support in backend/modules/tournament/src/bracket.rs, including Winners Bracket, Losers Bracket, and Grand Finals with bracket reset.

What was implemented

  • Bracket generation for 4–128 players producing valid match graphs for both odd and even participant counts.
  • Seeded auto-byes: when the participant count is not a power of two (e.g. 12 players → 16-slot bracket), byes are distributed to the highest-seeded players in Round 1 rather than randomly.
  • Winners Bracket routing: winners advance to the next Winners Bracket round; losers are routed into the Losers Bracket in seeded order without duplicate match pairings.
  • Losers Bracket progression: losers alternate through the Losers Bracket across the correct rounds (WB losers drop to the appropriate LB round and pair against LB winners).
  • Grand Finals with bracket reset: if the Losers Bracket champion defeats the Winners Bracket champion in the first Grand Final, a second Grand Final (bracket reset) is triggered; otherwise the tournament completes immediately.
  • Fixed Losers Bracket sizing and winner routing for non-power-of-two sizes so brackets always resolve to completion (previously a 32-player bracket overflowed and 12-player brackets stalled).

Tests

Added a unit test suite validating complete tournament progression and bracket generation for 8, 12, 16, and 32 player double-elimination brackets, including:

  • Valid Winners/Losers/Grand Finals match counts
  • Auto-bye distribution to top seeds
  • Loser routing into the Losers Bracket without duplicate pairings
  • Full tournament progression to a winner (8, 12, 16, 32 players)
  • Bracket reset triggering and completion when the Losers Bracket champion wins the first Grand Final

All existing single-elimination, round-robin, and new double-elimination tests pass (38 passed in the tournament crate).

Closes #1019

…progression

- Generate valid Double-Elimination match graphs for 4-128 players
- Distribute auto-byes to highest-seeded players in Round 1 for
  non-power-of-two participant counts (e.g. 12 players -> 4 byes)
- Route Winners Bracket losers into the Losers Bracket in seeded order
  without duplicate pairings
- Advance Losers Bracket winners through alternating rounds
- Implement Grand Finals with bracket reset when the Losers Bracket
  champion defeats the Winners Bracket champion in the first match
- Fix non-power-of-two LB sizing and winner routing so brackets complete
- Add unit tests covering 8, 12, 16, and 32 player brackets, full
  tournament progression, bye distribution, and bracket reset
@drips-wave

drips-wave Bot commented Aug 28, 2026

Copy link
Copy Markdown

@Samaro1 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@chinweobtagaz
chinweobtagaz merged commit 7ad1bdf into OpenKnight-Foundation:main Aug 28, 2026
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

Successfully merging this pull request may close these issues.

BE-44: Double-Elimination Tournament Bracket Engine with Auto-Bye Seeding

2 participants