mirror of
https://github.com/furyfire/trueskill.git
synced 2025-03-20 16:48:04 +00:00
First TwoPlayerTrueSkillCalculator unit test passed
This commit is contained in:
26
PHPSkills/Elo/GaussianEloCalculator.php
Normal file
26
PHPSkills/Elo/GaussianEloCalculator.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
namespace Moserware\Skills\Elo;
|
||||
|
||||
class GaussianEloCalculator extends TwoPlayerEloCalculator
|
||||
{
|
||||
// From the paper
|
||||
const STABLE_KFACTOR = 24;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(new KFactor(self::STABLE_KFACTOR));
|
||||
}
|
||||
|
||||
public function getPlayerWinProbability(GameInfo $gameInfo, $playerRating, $opponentRating)
|
||||
{
|
||||
$ratingDifference = $playerRating - $opponentRating;
|
||||
|
||||
// See equation 1.1 in the TrueSkill paper
|
||||
return GaussianDistribution::cumulativeTo(
|
||||
$ratingDifference
|
||||
/
|
||||
(sqrt(2) * $gameInfo->getBeta()));
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
Reference in New Issue
Block a user