mirror of
https://github.com/furyfire/trueskill.git
synced 2025-06-28 15:30:56 +00:00
Cleanup in src/, adding namespaces, removing php closing tag and general code cleanup
This commit is contained in:
26
src/FactorGraphs/ScheduleLoop.php
Normal file
26
src/FactorGraphs/ScheduleLoop.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user