public void TestPerformanceOfGenAlgos_WithSize150x150_DoesNotThrow() { var mazeGenAlgos = KnownMazesTypes.GetAllMazeAlgos(); Stopwatch sw = new Stopwatch(); foreach (IMazeGenAlgorithm algo in mazeGenAlgos) { var maze = new TileMapMaze(150, 150); algo.SetCurrentMaze(maze); double[] tests = new double[10]; for (int i = 10 - 1; i >= 0; i--) { sw.Start(); algo.GenerateMazeWithTranformationList(); sw.Stop(); tests[i] = sw.ElapsedTicks; sw.Reset(); } var testsEnumerable = tests.AsEnumerable <double>(); double median = testsEnumerable.Median(); Log.Logger.Information($"GenerateMazeFullSize {algo.GetName()} {maze.GetWidth()}x{maze.GetHeight()} Elapsed={TimeSpan.FromTicks(((long)median))}"); } }
private static List <object[]> GetArrayOfMazeAlgos() { var list = new List <object[]>(); var mazes = KnownMazesTypes.GetAllMazeAlgos().ToArray <object>(); var dimensonList = new List <(int, int)>() { (10, 10), // even, even (11, 11), // odd, odd (50, 80), // even, even(bigger) (80, 50), // even(bigger), even (17, 10), // odd(bigger), even (10, 17), // even, odd(bigger) }; foreach (IMazeGenAlgorithm algorithm in mazes) { foreach ((int, int)d in dimensonList) { list.Add(new object[] { algorithm, d }); } } return(list); }
public void CreateDemoImageAndGifs(IConfigurationRoot configRoot) { if (configRoot["CreateDemoImages"] != null) { bool run = configRoot["InfiniteDemo"] != null ? true : false; while (run) { var list = KnownMazesTypes.GetAllMazeAlgos(); var tasks = new List <Task>(); foreach (IMazeGenAlgorithm i in list) { tasks.Add(CreateImageAndGifForAlgoAsync(i)); } Task.WaitAll(tasks.ToArray()); Console.WriteLine("Tap key for another batch."); Console.ReadKey(); } } }