Exemplo n.º 1
0
 public function moveSnakeModules(SnakeBoard $board, $sessionId, $direction)
 {
     $board->setPlayers($this->getPlayers());
     $board->setBugs($this->getBugs());
     $player = $this->getPlayer($sessionId);
     if (!$player) {
         return null;
     }
     if ($player->isInGame()) {
         $board->movePlayer($player, $direction);
         $this->saveBugs($board->getBugs());
         $this->savePlayer($sessionId, $player);
     } else {
         return false;
     }
 }