コード例 #1
0
ファイル: EloTest.php プロジェクト: manishkhanchandani/mkgxy
 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;
 }