Ejemplo n.º 1
0
        private static void BuildTriangle()
        {
            Console.WriteLine("Triangle");

            var grid = TriangleGrid.CreateTriangleGrid(30, 50);

            var mazeBuilder = new RecursiveBacktracker();

            mazeBuilder.Build(grid);

            var distances = Distances.Build(grid.GetCell(0, 0));

            var gd     = GridDisplayFactory.GetDisplayForGrid(grid);
            var bitmap = gd.MakeImage(distances);

            bitmap.Save("Triangle.png", ImageFormat.Png);
            Console.WriteLine("Done");
        }
Ejemplo n.º 2
0
        static void TriangleGrid(int rows, int cols)
        {
            Random       random = new Random();
            int          seed   = random.Next(int.MinValue, int.MaxValue);
            TriangleGrid grid   = new TriangleGrid(rows, cols, seed);

            RecursiveBacktracker.CreateMaze <TriangleGrid, TriangleCell>(grid);

            Bitmap img  = grid.ToPNG(50);
            string name = "Maze.png";

            img.Save(name);

            Process process = new Process();

            process.StartInfo.FileName = name;
            process.Start();
            process.Close();
        }