dev-master
9999999-devUtils for round-robin tournaments. Laravel ready.
MIT
The Requires
- php >=5.6.4
The Development Requires
by Luca Gentile
laravel library scheduler tournaments teams round-robin berger
Wallogit.com
2017 © Pedro Peláez
Utils for round-robin tournaments. Laravel ready.
You can easily create round-robin rounds for a tournament., (*1)
Laravel ready., (*2)
There are two methods. One is BergerAlgorithm($teams) which takes an array of teams as argument and returns the set of matches., (*3)
Given an array of teams like:, (*4)
['Juventus', 'Milan', 'Roma', 'Napoli', 'Inter']
the method returns a multilevel array, in which the first level is the game day:, (*5)
[
[
['REST', 'Juventus'], ['Inter', 'Milan'], ['Napoli', 'Roma']
],
[
['Juventus', 'Milan'], ['Roma', 'REST'], ['Napoli', 'Inter']
],
[
['Roma', 'Juventus'], ['Milan', 'Napoli'], ['REST', 'Inter']
],
[
['Juventus', 'Napoli'], ['Inter', 'Roma'], ['REST', 'Milan']
],
[
['Inter', 'Juventus'], ['Napoli', 'REST'], ['Roma', 'Milan']
]
]
If the team count is odd, it adds a dummy team., (*6)
The other one is distributeAmongRounds($teams, $rounds) which takes as arguments an array of teams and the desired amount of rounds. I suggest you to shuffle() your team dataset before providing it to the function., (*7)
Given an array of teams like this and '3' as a desired amount of rounds:, (*8)
['Milan', 'Roma', 'Juventus', 'Napoli', 'Inter', 'Lazio', 'Fiorentina', 'Udinese', 'Sampdoria', 'Genoa'],
the method returns a multilevel array:, (*9)
[
['Genoa', 'Fiorentina', 'Napoli', 'Milan'],
['Sampdoria', 'Lazio', 'Juventus'],
['Udinese', 'Inter', 'Roma']
]
composer require lucagentile\roundrobin-scheduler
add the ServiceProvider class name under 'providers' in config/app.php https://laravel.com/docs/5.4/providers#registering-providers, (*10)
Gautile\RoundRobin\RoundRobinSchedulerServiceProvider::class
then add the alias under 'aliases' for the Facade, (*11)
'RoundRobinScheduler' => Gautile\RoundRobin\Facades\RoundRobinScheduler::class,
MIT, (*12)
Utils for round-robin tournaments. Laravel ready.
MIT
laravel library scheduler tournaments teams round-robin berger