/** * Return the average available time per move * * @return float **/ protected function calculateTimePerMove(Game $game) { if ($clock = $game->getClock()) { $totalTime = $clock->getLimit() + $game->getFullmoveNumber() * $clock->getIncrement(); $timePerMove = $totalTime / $game->getFullmoveNumber(); } else { $timePerMove = 60; } return $timePerMove; }
public function start(Game $game) { $game->start(); if ($game->getInvited()->getIsAi()) { return array(); } $messages = array(); $messages[] = ucfirst($game->getCreator()->getColor()) . ' creates the game'; $messages[] = ucfirst($game->getInvited()->getColor()) . ' joins the game'; if ($game->hasClock()) { $messages[] = 'Clock: ' . $game->getClock()->getName(); } if ($game->getIsRated()) { $messages[] = 'This game is rated'; } return $messages; }