/// <summary>
        /// Joins to an existing game.
        /// </summary>
        /// <param name="mazeName">Maze name.</param>
        public void JoinGame(string mazeName)
        {
            GameRoom room = model.JoinGame(mazeName, Context.ConnectionId);

            //Parse maze to json.
            Maze    maze     = room.RoomMaze;
            JObject jsonMaze = ToJsonParser.ToJson(maze);

            //Send the maze to both players.
            Clients.Client(room.PlayerOne.ConnectionId).gotMaze(jsonMaze);
            Clients.Client(room.PlayerTwo.ConnectionId).gotMaze(jsonMaze);
        }
        public JObject SolveMaze(string mazeName, string algorithmType)
        {
            //Solves the maze.
            Solution <Position> solution =
                model.SolveMaze(mazeName, int.Parse(algorithmType));

            if (solution == null)
            {
                return(null);
            }

            //Parse solution to json.
            JObject jsonSolution = ToJsonParser.ToJson(solution, mazeName);

            return(jsonSolution);
        }
        public JObject GenerateMaze(string mazeName, string rows,
                                    string columns)
        {
            Maze maze = model.GenerateMaze(mazeName, int.Parse(rows),
                                           int.Parse(columns));

            if (maze == null)
            {
                return(null);
            }

            //Parse maze to json.
            JObject jsonMaze = ToJsonParser.ToJson(maze);

            return(jsonMaze);
        }