2023-08-02 09:04:56 +00:00
|
|
|
<?php
|
|
|
|
|
2024-02-29 10:42:31 +00:00
|
|
|
require_once(__DIR__ . "/../vendor/autoload.php");
|
2023-08-02 09:04:56 +00:00
|
|
|
|
|
|
|
use DNW\Skills\TrueSkill\TwoPlayerTrueSkillCalculator;
|
|
|
|
use DNW\Skills\GameInfo;
|
|
|
|
use DNW\Skills\Player;
|
|
|
|
use DNW\Skills\Team;
|
|
|
|
use DNW\Skills\Teams;
|
|
|
|
|
|
|
|
$gameInfo = new GameInfo();
|
|
|
|
|
|
|
|
$p1 = new Player("Winner");
|
|
|
|
$p2 = new Player("Average");
|
|
|
|
|
|
|
|
|
|
|
|
$team1 = new Team($p1, $gameInfo->getDefaultRating());
|
|
|
|
|
|
|
|
$team2 = new Team($p2, $gameInfo->getDefaultRating());
|
|
|
|
|
2024-01-12 14:54:04 +00:00
|
|
|
|
2024-09-13 07:26:48 +00:00
|
|
|
for ($i = 0; $i < 5; ++$i) {
|
2024-02-21 13:48:37 +00:00
|
|
|
echo "Iteration: " . $i . PHP_EOL;
|
2024-05-14 11:12:26 +00:00
|
|
|
$teams = [$team1, $team2];
|
2023-08-02 09:04:56 +00:00
|
|
|
|
|
|
|
$calculator = new TwoPlayerTrueSkillCalculator();
|
|
|
|
|
|
|
|
$newRatings = $calculator->calculateNewRatings($gameInfo, $teams, [1, 2]);
|
|
|
|
|
|
|
|
$team1 = new Team($p1, $newRatings->getRating($p1));
|
|
|
|
$team2 = new Team($p2, $newRatings->getRating($p2));
|
|
|
|
|
2024-09-13 07:26:48 +00:00
|
|
|
echo "P1: " . $newRatings->getRating($p1)->getConservativeRating() . PHP_EOL;
|
|
|
|
echo "P2: " . $newRatings->getRating($p2)->getConservativeRating() . PHP_EOL;
|
2023-08-02 09:04:56 +00:00
|
|
|
}
|