Example #1
0
 private function updateBot(Bot $bot)
 {
     if (rand(0, 100) < 20) {
         $f = new Friend();
         $f->setAccepter($bot->getProfile());
         $f->setRequester($this->getRandomBot()->getProfile());
         if (rand(0, 100) < 85) {
             $f->setAccepted(1);
         }
         try {
             $f->save();
         } catch (Exception $e) {
             fb($e->getMessage());
         }
     }
     $maxVoters = rand(0, 2);
     $voters = $maxVoters - round(atan(sqrt(rand(0, 10000) / 10000)) * $maxVoters);
     for ($i = 0; $i < $voters; $i++) {
         $v = new VoteProfile();
         $v->setProfile($bot->getProfile());
         $v->setValue($this->getRandomBot()->getProfile()->getForce());
         $v->setVoter($this->getRandomBot()->getProfile());
         $v->save();
     }
 }