mirror of
https://github.com/furyfire/trueskill.git
synced 2025-06-27 15:21:31 +00:00
Few more comments
This commit is contained in:
@ -3,10 +3,10 @@
|
||||
<phar name="phpmd" version="^2.15.0" installed="2.15.0" location="./tools/phpmd" copy="false"/>
|
||||
<phar name="phpstan" version="^2.1.12" installed="2.1.17" location="./tools/phpstan" copy="false"/>
|
||||
<phar name="psalm" version="^7.0.0-beta6" installed="7.0.0-beta9" location="./tools/psalm" copy="false"/>
|
||||
<phar name="phpcs" version="^3.12.2" installed="3.13.0" location="./tools/phpcs" copy="false"/>
|
||||
<phar name="phpcbf" version="^3.12.2" installed="3.13.0" location="./tools/phpcbf" copy="false"/>
|
||||
<phar name="phpdocumentor" version="^3.7.1" installed="3.7.1" location="./tools/phpdocumentor" copy="false"/>
|
||||
<phar name="phpcs" version="^3.12.2" installed="3.13.2" location="./tools/phpcs" copy="false"/>
|
||||
<phar name="phpcbf" version="^3.12.2" installed="3.13.2" location="./tools/phpcbf" copy="false"/>
|
||||
<phar name="phpdocumentor" version="^3.7.1" installed="3.8.0" location="./tools/phpdocumentor" copy="false"/>
|
||||
<phar name="phpbench" version="^1.4.1" installed="1.4.1" location="./tools/phpbench" copy="false"/>
|
||||
<phar name="infection" version="^0.29.14" installed="0.29.14" location="./tools/infection" copy="false"/>
|
||||
<phar name="phpunit" version="^12.1.3" installed="12.2.0" location="./tools/phpunit" copy="false"/>
|
||||
<phar name="phpunit" version="^12.1.3" installed="12.2.2" location="./tools/phpunit" copy="false"/>
|
||||
</phive>
|
||||
|
12
composer.lock
generated
12
composer.lock
generated
@ -837,16 +837,16 @@
|
||||
},
|
||||
{
|
||||
"name": "phpunit/phpunit",
|
||||
"version": "11.5.22",
|
||||
"version": "11.5.23",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
||||
"reference": "4cd72faaa8f811e4cc63040cba167757660a5538"
|
||||
"reference": "86ebcd8a3dbcd1857d88505109b2a2b376501cde"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/4cd72faaa8f811e4cc63040cba167757660a5538",
|
||||
"reference": "4cd72faaa8f811e4cc63040cba167757660a5538",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/86ebcd8a3dbcd1857d88505109b2a2b376501cde",
|
||||
"reference": "86ebcd8a3dbcd1857d88505109b2a2b376501cde",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -918,7 +918,7 @@
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
|
||||
"security": "https://github.com/sebastianbergmann/phpunit/security/policy",
|
||||
"source": "https://github.com/sebastianbergmann/phpunit/tree/11.5.22"
|
||||
"source": "https://github.com/sebastianbergmann/phpunit/tree/11.5.23"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@ -942,7 +942,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2025-06-06T02:48:05+00:00"
|
||||
"time": "2025-06-13T05:47:49+00:00"
|
||||
},
|
||||
{
|
||||
"name": "rector/rector",
|
||||
|
@ -10,12 +10,12 @@ namespace DNW\Skills;
|
||||
final class HashMap
|
||||
{
|
||||
/**
|
||||
* @var mixed[] $hashToValue
|
||||
* @var mixed[] $hashToValue Store the hash to value mapping.
|
||||
*/
|
||||
private array $hashToValue = [];
|
||||
|
||||
/**
|
||||
* @var mixed[] $hashToKey
|
||||
* @var mixed[] $hashToKey Store the hash to original key mapping.
|
||||
*/
|
||||
private array $hashToKey = [];
|
||||
|
||||
|
@ -29,11 +29,7 @@ final class TeamPerformancesToTeamPerformanceDifferencesLayer extends TrueSkillF
|
||||
}
|
||||
}
|
||||
|
||||
private function createTeamPerformanceToDifferenceFactor(
|
||||
Variable $strongerTeam,
|
||||
Variable $weakerTeam,
|
||||
Variable $output
|
||||
): GaussianWeightedSumFactor
|
||||
private function createTeamPerformanceToDifferenceFactor(Variable $strongerTeam, Variable $weakerTeam, Variable $output): GaussianWeightedSumFactor
|
||||
{
|
||||
$teams = [$strongerTeam, $weakerTeam];
|
||||
$weights = [1.0, -1.0];
|
||||
|
@ -33,6 +33,8 @@ final class TrueSkillFactorGraph extends FactorGraph
|
||||
private readonly PlayerPriorValuesToSkillsLayer $priorLayer;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param GameInfo $gameInfo Parameters for the game.
|
||||
* @param Team[] $teams A mapping of team players and their ratings.
|
||||
* @param int[] $teamRanks The ranks of the teams where 1 is first place. For a tie, repeat the number (e.g. 1, 2, 2).
|
||||
|
@ -32,11 +32,7 @@ final class TwoPlayerTrueSkillCalculator extends SkillCalculator
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
#[\Override]
|
||||
public function calculateNewRatings(
|
||||
GameInfo $gameInfo,
|
||||
array $teams,
|
||||
array $teamRanks
|
||||
): RatingContainer
|
||||
public function calculateNewRatings(GameInfo $gameInfo, array $teams, array $teamRanks): RatingContainer
|
||||
{
|
||||
// Basic argument checking
|
||||
$this->validateTeamCountAndPlayersCountPerTeam($teams);
|
||||
|
@ -64,13 +64,7 @@ final class TwoTeamTrueSkillCalculator extends SkillCalculator
|
||||
return $results;
|
||||
}
|
||||
|
||||
private static function updatePlayerRatings(
|
||||
GameInfo $gameInfo,
|
||||
RatingContainer $newPlayerRatings,
|
||||
Team $selfTeam,
|
||||
Team $otherTeam,
|
||||
PairwiseComparison $selfToOtherTeamComparison
|
||||
): void
|
||||
private static function updatePlayerRatings(GameInfo $gameInfo, RatingContainer $newPlayerRatings, Team $selfTeam, Team $otherTeam, PairwiseComparison $selfToOtherTeamComparison): void
|
||||
{
|
||||
$drawMargin = DrawMargin::getDrawMarginFromDrawProbability(
|
||||
$gameInfo->getDrawProbability(),
|
||||
|
@ -811,15 +811,15 @@ final class TrueSkillCalculatorTests
|
||||
|
||||
private static function sixteenTeamsOfOneNotDrawn(TestCase $testClass, SkillCalculator $calculator): void
|
||||
{
|
||||
$player1 = new Player(1);
|
||||
$player2 = new Player(2);
|
||||
$player3 = new Player(3);
|
||||
$player4 = new Player(4);
|
||||
$player5 = new Player(5);
|
||||
$player6 = new Player(6);
|
||||
$player7 = new Player(7);
|
||||
$player8 = new Player(8);
|
||||
$player9 = new Player(9);
|
||||
$player1 = new Player(1);
|
||||
$player2 = new Player(2);
|
||||
$player3 = new Player(3);
|
||||
$player4 = new Player(4);
|
||||
$player5 = new Player(5);
|
||||
$player6 = new Player(6);
|
||||
$player7 = new Player(7);
|
||||
$player8 = new Player(8);
|
||||
$player9 = new Player(9);
|
||||
$player10 = new Player(10);
|
||||
$player11 = new Player(11);
|
||||
$player12 = new Player(12);
|
||||
@ -830,15 +830,15 @@ final class TrueSkillCalculatorTests
|
||||
|
||||
$gameInfo = new GameInfo();
|
||||
|
||||
$team1 = new Team($player1, $gameInfo->getDefaultRating());
|
||||
$team2 = new Team($player2, $gameInfo->getDefaultRating());
|
||||
$team3 = new Team($player3, $gameInfo->getDefaultRating());
|
||||
$team4 = new Team($player4, $gameInfo->getDefaultRating());
|
||||
$team5 = new Team($player5, $gameInfo->getDefaultRating());
|
||||
$team6 = new Team($player6, $gameInfo->getDefaultRating());
|
||||
$team7 = new Team($player7, $gameInfo->getDefaultRating());
|
||||
$team8 = new Team($player8, $gameInfo->getDefaultRating());
|
||||
$team9 = new Team($player9, $gameInfo->getDefaultRating());
|
||||
$team1 = new Team($player1, $gameInfo->getDefaultRating());
|
||||
$team2 = new Team($player2, $gameInfo->getDefaultRating());
|
||||
$team3 = new Team($player3, $gameInfo->getDefaultRating());
|
||||
$team4 = new Team($player4, $gameInfo->getDefaultRating());
|
||||
$team5 = new Team($player5, $gameInfo->getDefaultRating());
|
||||
$team6 = new Team($player6, $gameInfo->getDefaultRating());
|
||||
$team7 = new Team($player7, $gameInfo->getDefaultRating());
|
||||
$team8 = new Team($player8, $gameInfo->getDefaultRating());
|
||||
$team9 = new Team($player9, $gameInfo->getDefaultRating());
|
||||
$team10 = new Team($player10, $gameInfo->getDefaultRating());
|
||||
$team11 = new Team($player11, $gameInfo->getDefaultRating());
|
||||
$team12 = new Team($player12, $gameInfo->getDefaultRating());
|
||||
|
Reference in New Issue
Block a user