mirror of
https://github.com/furyfire/trueskill.git
synced 2025-03-20 16:48:04 +00:00
Start of journey to actually give real names to factor graph variables using more PHP style
This commit is contained in:
@ -27,7 +27,7 @@ class PlayerPerformancesToTeamPerformancesLayer extends TrueSkillFactorGraphLaye
|
||||
{
|
||||
foreach ($this->getInputVariablesGroups() as $currentTeam)
|
||||
{
|
||||
$teamPerformance = &$this->createOutputVariable($currentTeam);
|
||||
$teamPerformance = $this->createOutputVariable($currentTeam);
|
||||
$newSumFactor = $this->createPlayerToTeamSumFactor($currentTeam, $teamPerformance);
|
||||
$this->addLayerFactor($newSumFactor);
|
||||
|
||||
@ -83,9 +83,14 @@ class PlayerPerformancesToTeamPerformancesLayer extends TrueSkillFactorGraphLaye
|
||||
|
||||
private function createOutputVariable(&$team)
|
||||
{
|
||||
///$teamMemberNames = String.Join(", ", team.Select(teamMember => teamMember.Key.ToString()).ToArray());
|
||||
$teamMemberNames = "TODO";
|
||||
return $this->getParentFactorGraph()->getVariableFactory()->createBasicVariable("Team[{0}]'s performance", $teamMemberNames);
|
||||
$memberNames = \array_map(function ($currentPlayer)
|
||||
{
|
||||
return (string)($currentPlayer->getKey());
|
||||
},
|
||||
$team);
|
||||
|
||||
$teamMemberNames = \join(", ", $memberNames);
|
||||
return $this->getParentFactorGraph()->getVariableFactory()->createBasicVariable("Team[" . $teamMemberNames . "]'s performance");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ class PlayerPriorValuesToSkillsLayer extends TrueSkillFactorGraphLayer
|
||||
{
|
||||
$parentFactorGraph = $this->getParentFactorGraph();
|
||||
$variableFactory = $parentFactorGraph->getVariableFactory();
|
||||
return $variableFactory->createKeyedVariable($key, "{0}'s skill", $key);
|
||||
return $variableFactory->createKeyedVariable($key, $key . "'s skill");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ class PlayerSkillsToPerformancesLayer extends TrueSkillFactorGraphLayer
|
||||
|
||||
private function createOutputVariable(&$key)
|
||||
{
|
||||
return $this->getParentFactorGraph()->getVariableFactory()->createKeyedVariable($key, "{0}'s performance", $key);
|
||||
return $this->getParentFactorGraph()->getVariableFactory()->createKeyedVariable($key, $key . "'s performance");
|
||||
}
|
||||
|
||||
public function createPriorSchedule()
|
||||
|
Reference in New Issue
Block a user