Exemple #1
0
        private static void DivideHorizontally(int row, int col, int height, int width)
        {
            int divideCell = rand.Next(height - 1);
            int passage_at = rand.Next(width);

            for (int i = 0; i < width; ++i)
            {
                if (i != passage_at)
                {
                    int r         = row + divideCell;
                    int c         = col + i;
                    int node      = g.GetNode(r, c);
                    int southnode = g.GetNode(r + 1, c);
                    g.removeEdge(node, southnode);
                    g.removeEdge(southnode, node);
                }
            }
            Divide(row, col, divideCell + 1, width);
            Divide(row + divideCell + 1, col, height - divideCell - 1, width);
        }