mirror of
https://github.com/furyfire/trueskill.git
synced 2025-06-28 15:30:56 +00:00
26 lines
708 B
PHP
26 lines
708 B
PHP
![]() |
<?php namespace Moserware\Skills\FactorGraphs;
|
||
|
|
||
|
class ScheduleLoop extends Schedule
|
||
|
{
|
||
|
private $_maxDelta;
|
||
|
private $_scheduleToLoop;
|
||
|
|
||
|
public function __construct($name, Schedule &$scheduleToLoop, $maxDelta)
|
||
|
{
|
||
|
parent::__construct($name);
|
||
|
$this->_scheduleToLoop = $scheduleToLoop;
|
||
|
$this->_maxDelta = $maxDelta;
|
||
|
}
|
||
|
|
||
|
public function visit($depth = -1, $maxDepth = 0)
|
||
|
{
|
||
|
$totalIterations = 1;
|
||
|
$delta = $this->_scheduleToLoop->visit($depth + 1, $maxDepth);
|
||
|
while ($delta > $this->_maxDelta) {
|
||
|
$delta = $this->_scheduleToLoop->visit($depth + 1, $maxDepth);
|
||
|
$totalIterations++;
|
||
|
}
|
||
|
|
||
|
return $delta;
|
||
|
}
|
||
|
}
|