Drarig29 / brackets-manager.js

A simple library to manage tournament brackets (round-robin, single elimination, double elimination).
https://drarig29.github.io/brackets-docs
MIT License
253 stars 40 forks source link

Improve `inner_outer` ordering for >32 players #199

Open Drarig29 opened 7 months ago

Drarig29 commented 7 months ago

Discussed in https://github.com/Drarig29/brackets-manager.js/discussions/198

Originally posted by **ricardofellinidev** March 3, 2024 Hello guys, I'm doing some tests to see the Seed Order and I have a doubt: Here is my dataset that I'm testing: ```js export const dataset8: Dataset = { title: 'Test', type: 'single_elimination', groupType: 'winner_bracket', roster: [ { id: 7, name: 'Player 1' }, { id: 55, name: 'Player 2' }, { id: 53, name: 'Player 3' }, { id: 56, name: 'Player 4' }, { id: 57, name: 'Player 5' }, { id: 58, name: 'Player 6' }, { id: 59, name: 'Player 7' }, { id: 60, name: 'Player 8' }, { id: 61, name: 'Player 9' }, { id: 62, name: 'Player 10' }, { id: 63, name: 'Player 11' }, { id: 64, name: 'Player 12' }, { id: 65, name: 'Player 13' }, { id: 66, name: 'Player 14' }, { id: 67, name: 'Player 15' }, { id: 68, name: 'Player 16' }, { id: 69, name: 'Player 17' }, { id: 70, name: 'Player 18' }, { id: 71, name: 'Player 19' }, { id: 72, name: 'Player 20' }, { id: 73, name: 'Player 21' }, { id: 74, name: 'Player 22' }, { id: 75, name: 'Player 23' }, { id: 76, name: 'Player 24' }, { id: 77, name: 'Player 25' }, { id: 78, name: 'Player 26' }, { id: 79, name: 'Player 27' }, { id: 80, name: 'Player 28' }, { id: 81, name: 'Player 29' }, { id: 82, name: 'Player 30' }, { id: 83, name: 'Player 31' }, { id: 84, name: 'Player 32' }, // { id: 85, name: 'Player 33' }, // { id: 86, name: 'Player 34' }, // { id: 87, name: 'Player 35' }, // { id: 88, name: 'Player 36' }, // { id: 89, name: 'Player 37' }, // { id: 90, name: 'Player 38' }, // { id: 91, name: 'Player 39' }, // { id: 92, name: 'Player 40' }, // { id: 93, name: 'Player 41' }, // { id: 94, name: 'Player 42' }, // { id: 95, name: 'Player 43' }, // { id: 96, name: 'Player 44' }, // { id: 97, name: 'Player 45' }, // { id: 98, name: 'Player 46' }, // { id: 99, name: 'Player 47' }, // { id: 100, name: 'Player 48' }, ], }; ``` On my real scenario it will come from a Ranking database ordering by points, so the Player top 1 of the ranking will be the first on the Bracket which is working, for the tournament to be more competitive, Player 2 should be in the second block to avoid conflict with the first in the ranking at the beginning, if I make a bracket of 16 players this works, if there are more, it doesn't. **Example 16 Players:** As you can see the Player 1 and Player 2 will match only in the finals: ![image](https://github.com/Drarig29/brackets-manager.js/assets/150211342/4cb30bc3-766a-4af8-aff1-642f4bfbef06) **Example 32 Players:** In this case they will match on the quarters. ![image](https://github.com/Drarig29/brackets-manager.js/assets/150211342/37d27da1-e8a1-4e53-85f5-e80bdb400dfc) My code to seed: ```js await manager.create({ name: dataset.title, tournamentId: 1, type: dataset.type, seeding: dataset.roster.map((player) => player.name), settings: { groupCount: 2, seedOrdering: ['inner_outer'], // roundRobinMode: 'simple', size: getNearestPowerOfTwo(dataset.roster.length), }, }); ``` Am I doing something wrong here? Really appreciate your help. Thank you!
ricardofellinidev commented 5 months ago

@Drarig29 Hello - any chance on it? I guess I wont be able to use with this bug, is there any way I can help? thanks