estbase / round-robin
生成锦标赛轮换赛程的包。
v2.0.0
2024-05-23 16:50 UTC
Requires
- php: ^8.3
Requires (Dev)
- phpunit/phpunit: ^11.1.3
This package is auto-updated.
Last update: 2024-09-23 17:27:26 UTC
README
EST Base 包
- 轮换赛程生成器
- 待补充
关于 Round-Robin EST 包
此包可以通过轮换系统立即生成锦标赛或季节性日历。
基于代码: https://github.com/mnito/round-robin
特性
- 通过轮换系统生成赛程
- 支持任意数量的队伍(最多不超过12或14支队伍)
- 能够按需生成多个轮次
- 能够配置为奇数队伍数量时添加轮空
- PHP 8.3
- PHPUnit 测试
安装
如果您使用 Composer,请在您的终端运行
composer require estbase/round-robin
在其他情况下,请在所需包中添加以下行
"estbase/round-robin": "^2.0"
即可使用!
使用方法
简短调用,生成每位选手与其他每位选手各比赛一次的赛程
$schedule = Schedule::create(['A','B','C','D']);
或
$teams = ['A','B','C','D']; $schedule = Schedule::create($teams);
生成具有自定义轮次数量或每队与其他队各比赛两次的赛程
$teams = ['A','B','C','D']; $schedule = Schedule::create($teams, 5);
或
$teams = ['A','B','C','D']; $rounds = (($count = count($teams)) % 2 === 0 ? $count - 1 : $count) * 2; $schedule = Schedule::create($teams, $rounds);
生成带有或没有为奇数锦标赛添加轮空的赛程
此情况生成带有轮空的赛程。
$teams = ['A','B','C','D','E']; $schedule = Schedule::create($teams);
或没有
$teams = ['A','B','C','D','E']; $schedule = Schedule::create($teams, null, false);
生成不带随机洗牌的赛程
$schedule = Schedule::createSchedule(['A','B','C','D'],null,true, false);
使用自己的种子生成具有预定洗牌的赛程
$schedule = Schedule::createSchedule(['A','B','C','D'],null,true, true, 9);
许可证
EST Base round-robin 包是免费软件,根据 MIT 许可证的条款分发。