<commit_before>﻿using DeveMazeGenerator.Factories;
using DeveMazeGenerator.Generators;
using DeveMazeGenerator.Generators.Helpers;
using DeveMazeGenerator.Helpers;
using DeveMazeGenerator.Imageification;
using DeveMazeGenerator.InnerMaps;
using DeveMazeGenerator.PathFinders;
using System;
using System.Diagnostics;
using System.IO;

namespace DeveMazeGeneratorConsole
{
    public class Program
    {
        public static void Main(string[] args)
        {
            while (true)
            {
                Test7();

                Console.ReadKey();
            }
        }

        public static void Test7()
        {
            int size = 1024;

            var alg = new AlgorithmDivisionDynamicWithPath();
            var maze = alg.GenerateWithPath<BitArreintjeFastInnerMap, NetRandom>(size, size, 1337, null);

            using (var fs = new FileStream("DivisionDynamicWithPath.png", FileMode.Create))
            {
                WithPath.SaveMazeAsImageDeluxePng(maze, maze.PathData, fs);
            }

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

            //using (var fs = new FileStream("DivisionDynamicWithPath.png", FileMode.Create))
            //{
            //    WithoutPath.MazeToImage(maze, fs);
            //}
        }

        public static void Test6()
        {
            int size = 4096;

            var alg = new AlgorithmKruskal();
            var w = Stopwatch.StartNew();
            var maze = alg.Generate<BitArreintjeFastInnerMap, NetRandom>(size, size, 1337, null);
            Console.WriteLine($"Generation time: {w.Elapsed}");

            w.Restart();
            var result = MazeVerifier.IsPerfectMaze(maze);
            Console.WriteLine($"Perfect maze verification time: {w.Elapsed}");
            Console.WriteLine($"Is our maze perfect?: {result}");

            using (var fs = new FileStream("KruskalMaze.png", FileMode.Create))
            {
                WithoutPath.MazeToImage(maze, fs);
            }
        }

        public static void Test5()
        {
            var map = new BitArreintjeFastInnerMap(128, 128);

            for (int y = 33; y < 96; y++)
            {
                for (int x = 33; x < 96; x++)
                {
                    map[x, y] = true;
                }
            }

            var mapFactory = new InnerMapFactoryCustom<BitArreintjeFastInnerMap>(map);
            var randomFactory = new RandomFactory<NetRandom>(1337);

            var algorithm = new AlgorithmBacktrack();
            var generatedMap = algorithm.GoGenerate(mapFactory, randomFactory, null);

            var path = PathFinderDepthFirstSmartWithPos.GoFind(map, null);

            using (var fs = new FileStream("GeneratingAMazeWithABlockInTheMiddleWorks.png", FileMode.Create))
            {
                WithPath.SaveMazeAsImageDeluxePng(map, path, fs);
            }
        }

        public static void Test4()
        {
            int size = 16384;

            var alg = new AlgorithmBacktrack();
            var w = Stopwatch.StartNew();
            var maze = alg.Generate<BitArreintjeFastInnerMap, NetRandom>(size, size, 1337, null);
            Console.WriteLine($"Generation time: {w.Elapsed}");

            w.Restart();
            var result = MazeVerifier.IsPerfectMaze(maze);
            Console.WriteLine($"Perfect maze verification time: {w.Elapsed}");
            Console.WriteLine($"Is our maze perfect?: {result}");
        }

        public static void Test3()
        {
            int size = 128;

            var alg = new AlgorithmDivisionDynamic();
            var maze = alg.Generate<BitArreintjeFastInnerMap, 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);<commit_msg>Generating mazes benchmark more clear now<commit_after>﻿using DeveMazeGenerator.Factories;
using DeveMazeGenerator.Generators;
using DeveMazeGenerator.Generators.Helpers;
using DeveMazeGenerator.Helpers;
using DeveMazeGenerator.Imageification;
using DeveMazeGenerator.InnerMaps;
using DeveMazeGenerator.PathFinders;
using System;
using System.Diagnostics;
using System.IO;

namespace DeveMazeGeneratorConsole
{
    public class Program
    {
        public static void Main(string[] args)
        {
            while (true)
            {
                ActualBenchmark();

                Console.ReadKey();
            }
        }

        public static void Test7()
        {
            int size = 1024;

            var alg = new AlgorithmDivisionDynamicWithPath();
            var maze = alg.GenerateWithPath<BitArreintjeFastInnerMap, NetRandom>(size, size, 1337, null);

            using (var fs = new FileStream("DivisionDynamicWithPath.png", FileMode.Create))
            {
                WithPath.SaveMazeAsImageDeluxePng(maze, maze.PathData, fs);
            }

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

            //using (var fs = new FileStream("DivisionDynamicWithPath.png", FileMode.Create))
            //{
            //    WithoutPath.MazeToImage(maze, fs);
            //}
        }

        public static void Test6()
        {
            int size = 4096;

            var alg = new AlgorithmKruskal();
            var w = Stopwatch.StartNew();
            var maze = alg.Generate<BitArreintjeFastInnerMap, NetRandom>(size, size, 1337, null);
            Console.WriteLine($"Generation time: {w.Elapsed}");

            w.Restart();
            var result = MazeVerifier.IsPerfectMaze(maze);
            Console.WriteLine($"Perfect maze verification time: {w.Elapsed}");
            Console.WriteLine($"Is our maze perfect?: {result}");

            using (var fs = new FileStream("KruskalMaze.png", FileMode.Create))
            {
                WithoutPath.MazeToImage(maze, fs);
            }
        }

        public static void Test5()
        {
            var map = new BitArreintjeFastInnerMap(128, 128);

            for (int y = 33; y < 96; y++)
            {
                for (int x = 33; x < 96; x++)
                {
                    map[x, y] = true;
                }
            }

            var mapFactory = new InnerMapFactoryCustom<BitArreintjeFastInnerMap>(map);
            var randomFactory = new RandomFactory<NetRandom>(1337);

            var algorithm = new AlgorithmBacktrack();
            var generatedMap = algorithm.GoGenerate(mapFactory, randomFactory, null);

            var path = PathFinderDepthFirstSmartWithPos.GoFind(map, null);

            using (var fs = new FileStream("GeneratingAMazeWithABlockInTheMiddleWorks.png", FileMode.Create))
            {
                WithPath.SaveMazeAsImageDeluxePng(map, path, fs);
            }
        }

        public static void ActualBenchmark()
        {
            int size = 16384;

            var alg = new AlgorithmBacktrack();

            Console.WriteLine("Generating mazes...");

            int seed = 1337;
            while (true)
            {
                var w = Stopwatch.StartNew();
                var maze = alg.Generate<BitArreintjeFastInnerMap, XorShiftRandom>(size, size, seed, null);
                w.Stop();
                Console.WriteLine($"Generation time: {w.Elapsed}");
                seed++;
            }
        }

        public static void Test3()
        {
            int size = 128;

            var alg = new AlgorithmDivisionDynamic();
            var maze = alg.Generate<BitArreintjeFastInnerMap, 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);
{'fraction_non_alphanumeric': 0.10104940455135007, 'fraction_numerical': 0.016035844829619148, 'mean_word_length': 1.9167812929848693, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5311232', 'n_tokens_mistral': 2524, 'n_tokens_neox': 2306, 'n_words': 545}