zelenin/glicko2

Glicko2评分系统的PHP实现

1.0.0 2016-05-02 06:48 UTC

This package is not auto-updated.

Last update: 2024-09-14 17:42:45 UTC


README

Glicko2评分系统的PHP实现

安装

Composer

安装此扩展的首选方式是通过Composer

运行以下命令之一

php composer.phar require zelenin/glicko2 "~1.0.0"

或将其添加到你的composer.json文件的require部分

"zelenin/glicko2": "~1.0.0"

用法

创建两个具有当前评分的玩家

use Zelenin\Glicko2\Glicko2;
use Zelenin\Glicko2\Match;
use Zelenin\Glicko2\MatchCollection;
use Zelenin\Glicko2\Player;

$glicko = new Glicko2();

$player1 = new Player(1700, 250, 0.05);
$player2 = new Player();

$match = new Match($player1, $player2, 1, 0);
$glicko->calculateMatch($match);

$match = new Match($player1, $player2, 3, 2);
$glicko->calculateMatch($match);

// or

$matchCollection = new MatchCollection();
$matchCollection->addMatch(new Match($player1, $player2, 1, 0));
$matchCollection->addMatch(new Match($player1, $player2, 3, 2));
$glicko->calculateMatches($matchCollection);

$newPlayer1R = $player1->getR();
$newPlayer2R = $player2->getR();

作者

Aleksandr Zelenin,邮箱:aleksandr@zelenin.me