PHP code example of youhey / glicko2

1. Go to this page and download the library: Download youhey/glicko2 library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

youhey / glicko2 example snippets


use Youhey\Glicko2\Glicko2;
use Youhey\Glicko2\Match;
use Youhey\Glicko2\Player;

$glicko = new Glicko2();

$player = new Player(1700.0, 250.0, 0.05);
$opponent = new Player(1650.0, 350.0, 0.06);

$match = new Match($player, $opponent, 1.0, 0.0);
$glicko->calculateMatch($match);

$match = new Match($player, $opponent, 3.0, 2.0);
$glicko->calculateMatch($match);

$newPlayerRating = $player->getRating();
$newOpponentRating = $opponent->getRating();

php composer.phar