2017 © Pedro Peláez
 

library roundrobin-scheduler

Utils for round-robin tournaments. Laravel ready.

image

lucagentile/roundrobin-scheduler

Utils for round-robin tournaments. Laravel ready.

  • Friday, August 18, 2017
  • by lucagentile
  • Repository
  • 1 Watchers
  • 2 Stars
  • 3 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Round-robin scheduler

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']
]

Installation

composer require lucagentile\roundrobin-scheduler

Laravel:

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,

License

MIT, (*12)

The Versions

18/08 2017

dev-master

9999999-dev

Utils for round-robin tournaments. Laravel ready.

  Sources   Download

MIT

The Requires

  • php >=5.6.4

 

The Development Requires

by Luca Gentile

laravel library scheduler tournaments teams round-robin berger