ilmala / tourney
A simple random tournament generator
0.1.1
2022-10-28 08:48 UTC
Requires
- php: ^8.1
- illuminate/collections: ^9.36
- illuminate/support: ^9.36
Requires (Dev)
- pestphp/pest: ^1.22
README
A simple random tournament generator
Features:
- From 3 to 30 teams tournament
- Even and Odd team number with rest turn
How to use:
use Tourney\Tourney; $teamNames = [ 'Bayern Monaco', 'Olimpia Milano', 'Partizan', 'Virtus Bologna' ]; $tournament = (new Tourney())->generate( participants: $teams, );
Print out results:
// Basic Loop foreach ($tournament->turns() as $turn) { echo "Turn {$turn->number()}<br>"; foreach ($turn->games() as $game) { echo "{$game->description()}<br>"; } echo "<br>"; }
Team can be an instance of Tourney\Models\Team
class:
$team = new \Tourney\Models\Team( name: 'Olimpia Milano', key: 'OM-01', ); $team->name(); // The name of the Team $team->key(); // Maybe a reference key of your application team model