public void GeneratesAMaze() { //Arrange var generator = new AlgorithmKruskal(); long current = 0; long total = 0; var mazeAction = new Action <int, int, long, long>((x, y, cur, tot) => { current = cur; total = tot; }); //Act var map = generator.Generate <BitArreintjeFastInnerMap, NetRandom>(128, 128, mazeAction); //Assert Trace.WriteLine("Taken steps: " + current); Trace.WriteLine("Total steps: " + total); Assert.NotEqual(0, total); Assert.Equal(total, current); Assert.False(map[0, 0]); Assert.True(map[1, 1]); }
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); } }