private function getKFactor(Elo $elo) { if ($elo->getElo() > 2400) { return 16; } if ($elo->getElo() >= 2100) { return 24; } return 32; }
private function getUserWithNonProvisionalElo($eloValue = null) { $pl = new Player(); $pl->setUsername(uniqid('user')); $pl->setPassword(uniqid('pass')); $pl->commit(); $eloSetter = new EloSetter(1); for ($i = 0; $i < 10; $i++) { $eloSetter->registerResult($pl, $this->getUserWithElo(1500), 1); $eloSetter->registerResult($pl, $this->getUserWithElo(1400), 1); $eloSetter->registerResult($pl, $this->getUserWithElo(1200), -1); $eloSetter->registerResult($pl, $this->getUserWithElo(2000), 0.5); } if (isset($eloValue)) { $elo = new Elo($pl->getId(), 1); $elo->setElo($eloValue); $elo->commit(); return new Player($pl->getId()); } return $pl; }
public function getElo($category) { $elo = new Elo($this->getId(), $category); return $elo->getElo(); }