Example #1
0
 private function newGame()
 {
     $board = new Board();
     $board->width = 8;
     $board->height = 12;
     $board->generateNewBoard(15);
     $game = new Game($board, $this->chat->id, null, new GameState(GameState::Reveal));
     return $game;
 }
Example #2
0
 public function select_game($chat_id)
 {
     $sql = 'SELECT * FROM ms_games WHERE chat_id = :chat_id';
     $query = $this->db->prepare($sql);
     $query->bindParam(':chat_id', $chat_id);
     $query->execute();
     if ($query->rowCount()) {
         $result = $query->fetch();
         $board = new Board();
         $board->fromDbString($result['board'], $result['width'], $result['height']);
         return new Game($board, $chat_id, $result['id']);
     }
     return false;
 }