Example #1
0
    private static void RecursivePass(MazeCell current)
    {
        current.Visited = true;
        MazeCell next = current.GetRandomUnvisitedNeighbour(grid);

        if (next != null)
        {
            stack.Add(current);

            current.RemoveWalls(next);
            RecursivePass(next);
        }
        else if (stack.Count > 0)
        {
            MazeCell back = stack[stack.Count - 1];
            stack.RemoveAt(stack.Count - 1);
            RecursivePass(back);
        }
    }