Files
trueskill/src/FactorGraphs/ScheduleLoop.php

24 lines
587 B
PHP
Raw Normal View History

2022-07-05 15:55:47 +02:00
<?php
namespace DNW\Skills\FactorGraphs;
class ScheduleLoop extends Schedule
{
2022-07-05 16:21:06 +02:00
public function __construct($name, private readonly Schedule $_scheduleToLoop, private $_maxDelta)
{
parent::__construct($name);
}
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;
}
2022-07-05 15:55:47 +02:00
}