Пример #1
0
        public ActionResult GenerateMaze(int width, int height)
        {
            var alg = new AlgorithmDivisionDynamic();

            var map = alg.Generate <UndefinedInnerMap, NetRandom>(width, height, null);

            using (var memoryStream = new MemoryStream())
            {
                WithoutPath.MazeToImage(map, memoryStream);

                var data = memoryStream.ToArray();
                return(File(data, "image/png"));
            }
        }
        public static void Test3()
        {
            int size = 128;

            var alg  = new AlgorithmDivisionDynamic();
            var maze = alg.Generate <UndefinedInnerMap, NetRandom>(size, size, 1337, null);

            WithoutPath.SaveMaze(Path.Combine($"dinges.png"), maze);


            var otherThing = new AlgorithmDivisionDynamicOldTestingThing(size, size, 1337);

            int b     = size / 2;
            var part1 = otherThing.GenerateMapPart(0, 0, b, b);
            var part2 = otherThing.GenerateMapPart(b, 0, b, b);
            var part3 = otherThing.GenerateMapPart(0, b, b, b);
            var part4 = otherThing.GenerateMapPart(b, b, b, b);

            WithoutPath.SaveMaze("part1.png", part1);
            WithoutPath.SaveMaze("part2.png", part2);
            WithoutPath.SaveMaze("part3.png", part3);
            WithoutPath.SaveMaze("part4.png", part4);
        }