mirror of
				https://github.com/furyfire/trueskill.git
				synced 2025-11-04 02:02:29 +01:00 
			
		
		
		
	Few more comments
This commit is contained in:
		@@ -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(),
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user