mirror of
https://github.com/furyfire/trueskill.git
synced 2025-03-20 16:48:04 +00:00
Fixed an array size issue because of ignored 0 value
This commit is contained in:
@ -59,16 +59,19 @@ class IteratedTeamDifferencesInnerLayer extends TrueSkillFactorGraphLayer
|
||||
$totalTeams = $totalTeamDifferences + 1;
|
||||
|
||||
$localFactors = &$this->_TeamPerformancesToTeamPerformanceDifferencesLayer->getLocalFactors();
|
||||
|
||||
$firstDifferencesFactor = &$localFactors[0];
|
||||
$lastDifferencesFactor = &$localFactors[$totalTeamDifferences - 1];
|
||||
$innerSchedule = new ScheduleSequence(
|
||||
"inner schedule",
|
||||
array(
|
||||
$loop,
|
||||
new ScheduleStep(
|
||||
"teamPerformanceToPerformanceDifferenceFactors[0] @ 1",
|
||||
&$localFactors[0], 1),
|
||||
$firstDifferencesFactor, 1),
|
||||
new ScheduleStep(
|
||||
sprintf("teamPerformanceToPerformanceDifferenceFactors[teamTeamDifferences = %d - 1] @ 2", $totalTeamDifferences),
|
||||
&$localFactors[$totalTeamDifferences - 1], 2)
|
||||
$lastDifferencesFactor, 2)
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -25,9 +25,10 @@ class PlayerPerformancesToTeamPerformancesLayer extends TrueSkillFactorGraphLaye
|
||||
|
||||
public function buildLayer()
|
||||
{
|
||||
foreach ($this->getInputVariablesGroups() as $currentTeam)
|
||||
$inputVariablesGroups = &$this->getInputVariablesGroups();
|
||||
foreach ($inputVariablesGroups as &$currentTeam)
|
||||
{
|
||||
$teamPerformance = $this->createOutputVariable($currentTeam);
|
||||
$teamPerformance = &$this->createOutputVariable($currentTeam);
|
||||
$newSumFactor = $this->createPlayerToTeamSumFactor($currentTeam, $teamPerformance);
|
||||
$this->addLayerFactor($newSumFactor);
|
||||
|
||||
|
@ -29,9 +29,10 @@ class PlayerSkillsToPerformancesLayer extends TrueSkillFactorGraphLayer
|
||||
{
|
||||
$currentTeamPlayerPerformances = array();
|
||||
|
||||
foreach ($currentTeam as $playerSkillVariable)
|
||||
foreach ($currentTeam as &$playerSkillVariable)
|
||||
{
|
||||
$playerPerformance = $this->createOutputVariable($playerSkillVariable->getKey());
|
||||
$currentPlayer = &$playerSkillVariable->getKey();
|
||||
$playerPerformance = $this->createOutputVariable($currentPlayer);
|
||||
$newLikelihoodFactor = $this->createLikelihood($playerSkillVariable, $playerPerformance);
|
||||
$this->addLayerFactor($newLikelihoodFactor);
|
||||
$currentTeamPlayerPerformances[] = $playerPerformance;
|
||||
|
Reference in New Issue
Block a user