mirror of
				https://github.com/furyfire/trueskill.git
				synced 2025-11-04 02:02:29 +01:00 
			
		
		
		
	Stringable removed.
This commit is contained in:
		@@ -13,7 +13,9 @@ namespace DNW\Skills\Numerics;
 | 
			
		||||
class GaussianDistribution
 | 
			
		||||
{
 | 
			
		||||
    private const DEFAULT_STANDARD_DEVIATION = 1.0;
 | 
			
		||||
 | 
			
		||||
    private const DEFAULT_MEAN = 0.0;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Square Root 2π.
 | 
			
		||||
     * Precalculated constant for performance reasons
 | 
			
		||||
@@ -42,8 +44,7 @@ class GaussianDistribution
 | 
			
		||||
 | 
			
		||||
    public function __construct(private float $mean = self::DEFAULT_MEAN, private float $standardDeviation = self::DEFAULT_STANDARD_DEVIATION)
 | 
			
		||||
    {
 | 
			
		||||
        if($mean == self::DEFAULT_MEAN && $standardDeviation == self::DEFAULT_STANDARD_DEVIATION)
 | 
			
		||||
        {
 | 
			
		||||
        if ($mean == self::DEFAULT_MEAN && $standardDeviation == self::DEFAULT_STANDARD_DEVIATION) {
 | 
			
		||||
            //Use all the defaults
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
@@ -187,7 +188,7 @@ class GaussianDistribution
 | 
			
		||||
        return $multiplier * $expPart;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static function cumulativeTo(float $x, float $mean = 0.0, float $standardDeviation = 1.0): float
 | 
			
		||||
    public static function cumulativeTo(float $x): float
 | 
			
		||||
    {
 | 
			
		||||
        $result = GaussianDistribution::errorFunctionCumulativeTo(-M_SQRT1_2 * $x);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -59,9 +59,4 @@ class Player implements ISupportPartialPlay, ISupportPartialUpdate
 | 
			
		||||
    {
 | 
			
		||||
        return $this->PartialUpdatePercentage;
 | 
			
		||||
    }
 | 
			
		||||
/*
 | 
			
		||||
    public function __toString(): string
 | 
			
		||||
    {
 | 
			
		||||
        return (string)$this->Id;
 | 
			
		||||
    }*/
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,7 @@ use DNW\Skills\Numerics\GaussianDistribution;
 | 
			
		||||
/**
 | 
			
		||||
 * Container for a player's rating.
 | 
			
		||||
 */
 | 
			
		||||
class Rating implements \Stringable
 | 
			
		||||
class Rating
 | 
			
		||||
{
 | 
			
		||||
    private const CONSERVATIVE_STANDARD_DEVIATION_MULTIPLIER = 3;
 | 
			
		||||
 | 
			
		||||
@@ -73,9 +73,4 @@ class Rating implements \Stringable
 | 
			
		||||
 | 
			
		||||
        return new Rating($partialPosteriorGaussion->getMean(), $partialPosteriorGaussion->getStandardDeviation(), $prior->conservativeStandardDeviationMultiplier);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function __toString(): string
 | 
			
		||||
    {
 | 
			
		||||
        return sprintf('mean=%.4f, standardDeviation=%.4f', $this->mean, $this->standardDeviation);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -77,6 +77,6 @@ class PlayerPriorValuesToSkillsLayer extends TrueSkillFactorGraphLayer
 | 
			
		||||
        $parentFactorGraph = $this->getParentFactorGraph();
 | 
			
		||||
        $variableFactory = $parentFactorGraph->getVariableFactory();
 | 
			
		||||
 | 
			
		||||
        return $variableFactory->createKeyedVariable($key, (string)$key->getId() . "'s skill");
 | 
			
		||||
        return $variableFactory->createKeyedVariable($key, $key->getId() . "'s skill");
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -48,7 +48,7 @@ class PlayerSkillsToPerformancesLayer extends TrueSkillFactorGraphLayer
 | 
			
		||||
 | 
			
		||||
    private function createOutputVariable(mixed $key): KeyedVariable
 | 
			
		||||
    {
 | 
			
		||||
        return $this->getParentFactorGraph()->getVariableFactory()->createKeyedVariable($key, (string)$key->getId() . "'s performance");
 | 
			
		||||
        return $this->getParentFactorGraph()->getVariableFactory()->createKeyedVariable($key, $key->getId() . "'s performance");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function createPriorSchedule(): ?ScheduleSequence
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user