PHP code example of zelenin / glicko2

1. Go to this page and download the library: Download zelenin/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/ */

    

zelenin / glicko2 example snippets


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();

php composer.phar