zelenin / glicko2
A PHP implementation of Glicko2 rating system
Installs: 1 324
Dependents: 0
Suggesters: 0
Security: 0
Stars: 8
Watchers: 2
Forks: 5
Open Issues: 0
Requires
- php: >=5.4.0
Requires (Dev)
- phpunit/phpunit: ~5.3.0
This package is not auto-updated.
Last update: 2024-12-21 19:05:07 UTC
README
A PHP implementation of Glicko2 rating system
Installation
Composer
The preferred way to install this extension is through Composer.
Either run
php composer.phar require zelenin/glicko2 "~1.0.0"
or add
"zelenin/glicko2": "~1.0.0"
to the require section of your composer.json
Usage
Create two players with current ratings:
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();
Author
Aleksandr Zelenin, e-mail: aleksandr@zelenin.me