mirror of
				https://github.com/furyfire/trueskill.git
				synced 2025-11-04 10:12:28 +01:00 
			
		
		
		
	Added more header stuff (requires and uses) along with a forgotten PartialPlay
This commit is contained in:
		@@ -1,6 +1,14 @@
 | 
				
			|||||||
<?php
 | 
					<?php
 | 
				
			||||||
namespace Moserware\Skills\Elo;
 | 
					namespace Moserware\Skills\Elo;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					require_once(dirname(__FILE__) . "/../GameInfo.php");
 | 
				
			||||||
 | 
					require_once(dirname(__FILE__) . "/../Numerics/GaussianDistribution.php");
 | 
				
			||||||
 | 
					require_once(dirname(__FILE__) . "/KFactor.php");
 | 
				
			||||||
 | 
					require_once(dirname(__FILE__) . "/TwoPlayerEloCalculator.php");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use Moserware\Skills\GameInfo;
 | 
				
			||||||
 | 
					use Moserware\Numerics\GaussianDistribution;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class GaussianEloCalculator extends TwoPlayerEloCalculator
 | 
					class GaussianEloCalculator extends TwoPlayerEloCalculator
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    // From the paper
 | 
					    // From the paper
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,8 @@
 | 
				
			|||||||
<?php
 | 
					<?php
 | 
				
			||||||
namespace Moserware\Skills\FactorGraphs;
 | 
					namespace Moserware\Skills\FactorGraphs;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					require_once(dirname(__FILE__) . "Schedule.php");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
abstract class FactorGraphLayer
 | 
					abstract class FactorGraphLayer
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    private $_localFactors = array();
 | 
					    private $_localFactors = array();
 | 
				
			||||||
@@ -63,5 +65,4 @@ abstract class FactorGraphLayer
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
?>
 | 
					?>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,6 +2,8 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
namespace Moserware\Skills\FactorGraphs;
 | 
					namespace Moserware\Skills\FactorGraphs;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					require_once(dirname(__FILE__) . "Factor.php");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/// <summary>
 | 
					/// <summary>
 | 
				
			||||||
/// Helper class for computing the factor graph's normalization constant.
 | 
					/// Helper class for computing the factor graph's normalization constant.
 | 
				
			||||||
/// </summary>
 | 
					/// </summary>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,6 +2,8 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
namespace Moserware\Skills\FactorGraphs;
 | 
					namespace Moserware\Skills\FactorGraphs;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					require_once(dirname(__FILE__) . "Variable.php");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class VariableFactory
 | 
					class VariableFactory
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    // using a Func<TValue> to encourage fresh copies in case it's overwritten
 | 
					    // using a Func<TValue> to encourage fresh copies in case it's overwritten
 | 
				
			||||||
@@ -23,6 +25,6 @@ class VariableFactory
 | 
				
			|||||||
        $newVar = new KeyedVariable($key, $this->_variablePriorInitializer());
 | 
					        $newVar = new KeyedVariable($key, $this->_variablePriorInitializer());
 | 
				
			||||||
        return $newVar;
 | 
					        return $newVar;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}s
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
?>
 | 
					?>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,6 +2,34 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
namespace Moserware\Skills\TrueSkill;
 | 
					namespace Moserware\Skills\TrueSkill;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					require_once(dirname(__FILE__) . "/../GameInfo.php");
 | 
				
			||||||
 | 
					require_once(dirname(__FILE__) . "/../Guard.php");
 | 
				
			||||||
 | 
					require_once(dirname(__FILE__) . "/../ISupportPartialPlay.php");
 | 
				
			||||||
 | 
					require_once(dirname(__FILE__) . "/../ISupportPartialUpdate.php");
 | 
				
			||||||
 | 
					require_once(dirname(__FILE__) . "/../PartialPlay.php");
 | 
				
			||||||
 | 
					require_once(dirname(__FILE__) . "/../PlayersRange.php");
 | 
				
			||||||
 | 
					require_once(dirname(__FILE__) . "/../RankSorter.php");
 | 
				
			||||||
 | 
					require_once(dirname(__FILE__) . "/../SkillCalculator.php");
 | 
				
			||||||
 | 
					require_once(dirname(__FILE__) . "/../TeamsRange.php");
 | 
				
			||||||
 | 
					require_once(dirname(__FILE__) . "/../Numerics/BasicMath.php");
 | 
				
			||||||
 | 
					require_once(dirname(__FILE__) . "/../Numerics/Matrix.php");
 | 
				
			||||||
 | 
					require_once(dirname(__FILE__) . "/TrueSkillFactorGraph.php");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use Moserware\Numerics\DiagonalMatrix;
 | 
				
			||||||
 | 
					use Moserware\Numerics\Matrix;
 | 
				
			||||||
 | 
					use Moserware\Numerics\Vector;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use Moserware\Skills\GameInfo;
 | 
				
			||||||
 | 
					use Moserware\Skills\Guard;
 | 
				
			||||||
 | 
					use Moserware\Skills\ISupportPartialPlay;
 | 
				
			||||||
 | 
					use Moserware\Skills\ISupportPartialUpdate;
 | 
				
			||||||
 | 
					use Moserware\Skills\PartialPlay;
 | 
				
			||||||
 | 
					use Moserware\Skills\PlayersRange;
 | 
				
			||||||
 | 
					use Moserware\Skills\RankSorter;
 | 
				
			||||||
 | 
					use Moserware\Skills\SkillCalculator;
 | 
				
			||||||
 | 
					use Moserware\Skills\SkillCalculatorSupportedOptions;
 | 
				
			||||||
 | 
					use Moserware\Skills\TeamsRange;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/// <summary>
 | 
					/// <summary>
 | 
				
			||||||
/// Calculates TrueSkill using a full factor graph.
 | 
					/// Calculates TrueSkill using a full factor graph.
 | 
				
			||||||
/// </summary>
 | 
					/// </summary>
 | 
				
			||||||
@@ -30,12 +58,11 @@ class FactorGraphTrueSkillCalculator extends SkillCalculator
 | 
				
			|||||||
        return $factorGraph->getUpdatedRatings();
 | 
					        return $factorGraph->getUpdatedRatings();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
    public function calculateMatchQuality(GameInfo $gameInfo,
 | 
					    public function calculateMatchQuality(GameInfo $gameInfo,
 | 
				
			||||||
                                          array $teams)
 | 
					                                          array $teams)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        // We need to create the A matrix which is the player team assigments.
 | 
					        // We need to create the A matrix which is the player team assigments.
 | 
				
			||||||
        $teamAssignmentsList = $teams.ToList();
 | 
					        $teamAssignmentsList = $teams;
 | 
				
			||||||
        $skillsMatrix = $this->getPlayerCovarianceMatrix($teamAssignmentsList);
 | 
					        $skillsMatrix = $this->getPlayerCovarianceMatrix($teamAssignmentsList);
 | 
				
			||||||
        $meanVector = $this->getPlayerMeansVector($teamAssignmentsList);
 | 
					        $meanVector = $this->getPlayerMeansVector($teamAssignmentsList);
 | 
				
			||||||
        $meanVectorTranspose = $meanVector->getTranspose();
 | 
					        $meanVectorTranspose = $meanVector->getTranspose();
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,14 +1,16 @@
 | 
				
			|||||||
<?php
 | 
					<?php
 | 
				
			||||||
namespace Moserware\Skills\TrueSkill\Layers;
 | 
					namespace Moserware\Skills\TrueSkill\Layers;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					require_once(dirname(__FILE__) . "../../FactorGraphs/Schedule.php");
 | 
				
			||||||
 | 
					require_once(dirname(__FILE__) . "../TrueSkillFactorGraph.php");
 | 
				
			||||||
require_once(dirname(__FILE__) . "TrueSkillFactorGraphLayer.php");
 | 
					require_once(dirname(__FILE__) . "TrueSkillFactorGraphLayer.php");
 | 
				
			||||||
require_once(dirname(__FILE__) . "TeamPerformancesToTeamPerformanceDifferencesLayer.php");
 | 
					require_once(dirname(__FILE__) . "TeamPerformancesToTeamPerformanceDifferencesLayer.php");
 | 
				
			||||||
require_once(dirname(__FILE__) . "TeamDifferencesComparisonLayer.php");
 | 
					require_once(dirname(__FILE__) . "TeamDifferencesComparisonLayer.php");
 | 
				
			||||||
require_once(dirname(__FILE__) . "../../FactorGraphs/Schedule.php");
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
use Moserware\Skills\FactorGraphs\ScheduleLoop;
 | 
					use Moserware\Skills\FactorGraphs\ScheduleLoop;
 | 
				
			||||||
use Moserware\Skills\FactorGraphs\ScheduleSequence;
 | 
					use Moserware\Skills\FactorGraphs\ScheduleSequence;
 | 
				
			||||||
use Moserware\Skills\FactorGraphs\ScheduleStep;
 | 
					use Moserware\Skills\FactorGraphs\ScheduleStep;
 | 
				
			||||||
 | 
					use Moserware\Skills\TrueSkill\TrueSkillFactorGraph;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// The whole purpose of this is to do a loop on the bottom
 | 
					// The whole purpose of this is to do a loop on the bottom
 | 
				
			||||||
class IteratedTeamDifferencesInnerLayer extends TrueSkillFactorGraphLayer
 | 
					class IteratedTeamDifferencesInnerLayer extends TrueSkillFactorGraphLayer
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,14 +1,16 @@
 | 
				
			|||||||
<?php
 | 
					<?php
 | 
				
			||||||
namespace Moserware\Skills\TrueSkill\Layers;
 | 
					namespace Moserware\Skills\TrueSkill\Layers;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					require_once(dirname(__FILE__) . "../../FactorGraphs/Schedule.php");
 | 
				
			||||||
 | 
					require_once(dirname(__FILE__) . "../TrueSkillFactorGraph.php");
 | 
				
			||||||
require_once(dirname(__FILE__) . "TrueSkillFactorGraphLayer.php");
 | 
					require_once(dirname(__FILE__) . "TrueSkillFactorGraphLayer.php");
 | 
				
			||||||
require_once(dirname(__FILE__) . "TeamPerformancesToTeamPerformanceDifferencesLayer.php");
 | 
					require_once(dirname(__FILE__) . "TeamPerformancesToTeamPerformanceDifferencesLayer.php");
 | 
				
			||||||
require_once(dirname(__FILE__) . "TeamDifferencesComparisonLayer.php");
 | 
					require_once(dirname(__FILE__) . "TeamDifferencesComparisonLayer.php");
 | 
				
			||||||
require_once(dirname(__FILE__) . "../../FactorGraphs/Schedule.php");
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
use Moserware\Skills\FactorGraphs\ScheduleLoop;
 | 
					use Moserware\Skills\FactorGraphs\ScheduleLoop;
 | 
				
			||||||
use Moserware\Skills\FactorGraphs\ScheduleSequence;
 | 
					use Moserware\Skills\FactorGraphs\ScheduleSequence;
 | 
				
			||||||
use Moserware\Skills\FactorGraphs\ScheduleStep;
 | 
					use Moserware\Skills\FactorGraphs\ScheduleStep;
 | 
				
			||||||
 | 
					use Moserware\Skills\TrueSkill\TrueSkillFactorGraph;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class PlayerPerformancesToTeamPerformancesLayer extends TrueSkillFactorGraphLayer
 | 
					class PlayerPerformancesToTeamPerformancesLayer extends TrueSkillFactorGraphLayer
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,7 +1,18 @@
 | 
				
			|||||||
<?php
 | 
					<?php
 | 
				
			||||||
 | 
					 | 
				
			||||||
namespace Moserware\Skills\TrueSkill\Layers;
 | 
					namespace Moserware\Skills\TrueSkill\Layers;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					require_once(dirname(__FILE__) . "../../FactorGraphs/Schedule.php");
 | 
				
			||||||
 | 
					require_once(dirname(__FILE__) . "../../Numerics/BasicMath.php");
 | 
				
			||||||
 | 
					require_once(dirname(__FILE__) . "../TrueSkillFactorGraph.php");
 | 
				
			||||||
 | 
					require_once(dirname(__FILE__) . "../Factors/GaussianPriorFactor.php");
 | 
				
			||||||
 | 
					require_once(dirname(__FILE__) . "TrueSkillFactorGraphLayer.php");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use Moserware\Skills\FactorGraphs\ScheduleLoop;
 | 
				
			||||||
 | 
					use Moserware\Skills\FactorGraphs\ScheduleSequence;
 | 
				
			||||||
 | 
					use Moserware\Skills\FactorGraphs\ScheduleStep;
 | 
				
			||||||
 | 
					use Moserware\Skills\TrueSkill\TrueSkillFactorGraph;
 | 
				
			||||||
 | 
					use Moserware\Skills\TrueSkill\Factors\GaussianPriorFactor;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// We intentionally have no Posterior schedule since the only purpose here is to
 | 
					// We intentionally have no Posterior schedule since the only purpose here is to
 | 
				
			||||||
class PlayerPriorValuesToSkillsLayer extends TrueSkillFactorGraphLayer
 | 
					class PlayerPriorValuesToSkillsLayer extends TrueSkillFactorGraphLayer
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@@ -26,7 +37,8 @@ class PlayerPriorValuesToSkillsLayer extends TrueSkillFactorGraphLayer
 | 
				
			|||||||
                $currentTeamSkills[] = $playerSkill;
 | 
					                $currentTeamSkills[] = $playerSkill;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            OutputVariablesGroups.Add(currentTeamSkills);
 | 
					            $outputVariablesGroups = $this->getOutputVariablesGroups();
 | 
				
			||||||
 | 
					            $outputVariablesGroups[] = $currentTeamSkills;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,7 +1,16 @@
 | 
				
			|||||||
<?php
 | 
					<?php
 | 
				
			||||||
 | 
					 | 
				
			||||||
namespace Moserware\Skills\TrueSkill\Layers;
 | 
					namespace Moserware\Skills\TrueSkill\Layers;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					require_once(dirname(__FILE__) . "../../FactorGraphs/Schedule.php");
 | 
				
			||||||
 | 
					require_once(dirname(__FILE__) . "../../Numerics/BasicMath.php");
 | 
				
			||||||
 | 
					require_once(dirname(__FILE__) . "../TrueSkillFactorGraph.php");
 | 
				
			||||||
 | 
					require_once(dirname(__FILE__) . "../Factors/GaussianLikelihoodFactor.php");
 | 
				
			||||||
 | 
					require_once(dirname(__FILE__) . "TrueSkillFactorGraphLayer.php");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use Moserware\Skills\FactorGraphs\ScheduleStep;
 | 
				
			||||||
 | 
					use Moserware\Skills\TrueSkill\TrueSkillFactorGraph;
 | 
				
			||||||
 | 
					use Moserware\Skills\TrueSkill\Factors\GaussianLikelihoodFactor;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class PlayerSkillsToPerformancesLayer extends TrueSkillFactorGraphLayer
 | 
					class PlayerSkillsToPerformancesLayer extends TrueSkillFactorGraphLayer
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    public function __construct(TrueSkillFactorGraph $parentGraph)
 | 
					    public function __construct(TrueSkillFactorGraph $parentGraph)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,7 +1,17 @@
 | 
				
			|||||||
<?php
 | 
					<?php
 | 
				
			||||||
 | 
					 | 
				
			||||||
namespace Moserware\Skills\TrueSkill\Layers;
 | 
					namespace Moserware\Skills\TrueSkill\Layers;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					require_once(dirname(__FILE__) . "../DrawMargin.php");
 | 
				
			||||||
 | 
					require_once(dirname(__FILE__) . "../TrueSkillFactorGraph.php");
 | 
				
			||||||
 | 
					require_once(dirname(__FILE__) . "../Factors/GaussianGreaterThanFactor.php");
 | 
				
			||||||
 | 
					require_once(dirname(__FILE__) . "../Factors/GaussianWithinFactor.php");
 | 
				
			||||||
 | 
					require_once(dirname(__FILE__) . "TrueSkillFactorGraphLayer.php");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use Moserware\Skills\TrueSkill\DrawMargin;
 | 
				
			||||||
 | 
					use Moserware\Skills\TrueSkill\TrueSkillFactorGraph;
 | 
				
			||||||
 | 
					use Moserware\Skills\TrueSkill\Factors\GaussianGreaterThanFactor;
 | 
				
			||||||
 | 
					use Moserware\Skills\TrueSkill\Factors\GaussianWithinFactor;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class TeamDifferencesComparisonLayer extends TrueSkillFactorGraphLayer
 | 
					class TeamDifferencesComparisonLayer extends TrueSkillFactorGraphLayer
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    private $_epsilon;
 | 
					    private $_epsilon;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,7 +1,16 @@
 | 
				
			|||||||
<?php
 | 
					<?php
 | 
				
			||||||
 | 
					 | 
				
			||||||
namespace Moserware\Skills\TrueSkill\Layers;
 | 
					namespace Moserware\Skills\TrueSkill\Layers;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					require_once(dirname(__FILE__) . "../../FactorGraphs/Variable.php");
 | 
				
			||||||
 | 
					require_once(dirname(__FILE__) . "../TrueSkillFactorGraph.php");
 | 
				
			||||||
 | 
					require_once(dirname(__FILE__) . "../Factors/GaussianWeightedSumFactor.php");
 | 
				
			||||||
 | 
					require_once(dirname(__FILE__) . "TrueSkillFactorGraphLayer.php");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use Moserware\Skills\FactorGraphs\Variable;
 | 
				
			||||||
 | 
					use Moserware\Skills\TrueSkill\DrawMargin;
 | 
				
			||||||
 | 
					use Moserware\Skills\TrueSkill\TrueSkillFactorGraph;
 | 
				
			||||||
 | 
					use Moserware\Skills\TrueSkill\Factors\GaussianWeightedSumFactor;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class TeamPerformancesToTeamPerformanceDifferencesLayer extends TrueSkillFactorGraphLayer
 | 
					class TeamPerformancesToTeamPerformanceDifferencesLayer extends TrueSkillFactorGraphLayer
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    public function __construct(TrueSkillFactorGraph $parentGraph)
 | 
					    public function __construct(TrueSkillFactorGraph $parentGraph)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,7 +1,10 @@
 | 
				
			|||||||
<?php
 | 
					<?php
 | 
				
			||||||
 | 
					 | 
				
			||||||
namespace Moserware\Skills\TrueSkill\Layers;
 | 
					namespace Moserware\Skills\TrueSkill\Layers;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					require_once(dirname(__FILE__) . "../../FactorGraphs/FactorGraphLayer.php");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use Moserware\Skills\FactorGraphs\FactorGraphLayer;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
abstract class TrueSkillFactorGraphLayer extends FactorGraphLayer
 | 
					abstract class TrueSkillFactorGraphLayer extends FactorGraphLayer
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    public function __construct(TrueSkillFactorGraph $parentGraph)
 | 
					    public function __construct(TrueSkillFactorGraph $parentGraph)
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										30
									
								
								PartialPlay.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								PartialPlay.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,30 @@
 | 
				
			|||||||
 | 
					<?php
 | 
				
			||||||
 | 
					namespace Moserware\Skills;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					require_once(dirname(__FILE__) . "/ISupportPartialPlay.php");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class PartialPlay
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    public static function getPartialPlayPercentage($player)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        // If the player doesn't support the interface, assume 1.0 == 100%
 | 
				
			||||||
 | 
					        $supportsPartialPlay = $player instanceof ISupportPartialPlay;
 | 
				
			||||||
 | 
					        if (!$supportsPartialPlay)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            return 1.0;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $partialPlayPercentage = $partialPlay->getPartialPlayPercentage();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // HACK to get around bug near 0
 | 
				
			||||||
 | 
					        $smallestPercentage = 0.0001;
 | 
				
			||||||
 | 
					        if ($partialPlayPercentage < $smallestPercentage)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            $partialPlayPercentage = $smallestPercentage;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return $partialPlayPercentage;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					?>
 | 
				
			||||||
		Reference in New Issue
	
	Block a user