/**
     * \brief Function to generate the maze
     *
     * Uses the appropriate algorithm according to
     * the selected option in the UI and applies it to the 2d
     * array. Disposes the old maze.
     *
     * \return null
     */
    public void GenerateNewMaze(int sizeR, int sizeC)
    {
        //Better mazes are produced if number of rows and columns are odd
        if (sizeR % 2 == 0)
        {
            sizeR += 1;
        }
        if (sizeC % 2 == 0)
        {
            sizeC += 1;
        }

        //Destroy the old maze
        DisposeOldMaze();

        if (dropdown.value == 0)
        {
            backtracker = new RecursiveBacktracker();
            data        = backtracker.GenerateMaze(sizeR, sizeC);
        }
        else if (dropdown.value == 1)
        {
            prims = new Prims();
            data  = prims.Mazer(sizeR, sizeC);
        }
        else if (dropdown.value == 2)
        {
            krusk = new Kruskalls();
            data  = krusk.Mazer(sizeR, sizeC);
        }

        DisplayMaze();
    }