Exemple #1
0
        public void Computerphile_Maze()
        {
            // Arrange
//            Console.WriteLine($"{Directory.GetCurrentDirectory()}");
            var maze = ImageBasedMaze.Create("../../../../images/Computerphile.jpg");

            // Act
            var graph = MazeSolverUtility.CreateGraph(maze);

            // Assert
            Assert.Equal(23, graph.Nodes.Count);
        }
Exemple #2
0
        public void Daedelus_128x128_Maze()
        {
            // Arrange
//            Console.WriteLine($"{Directory.GetCurrentDirectory()}");
            var maze = ImageBasedMaze.Create("../../../../images/128x128.jpg");

            // Act
            var graph = MazeSolverUtility.CreateGraph(maze);

            // Assert
            Assert.Equal(11655, graph.Nodes.Count);
        }
Exemple #3
0
        public void Daedelus_63x63_Exit()
        {
            // Arrange
            var maze = ImageBasedMaze.Create("../../../../images/31x31.jpg");

            // Act
            var entrance = MazeSolverUtility.Exit(maze);

            // Assert
            Assert.Equal(new Point {
                X = 37, Y = maze.Height - 1
            }, entrance);
        }
Exemple #4
0
        public void Computerphile_Maze_Exit()
        {
            // Arrange
            var maze = ImageBasedMaze.Create("../../../../images/Computerphile.jpg");

            // Act
            var entrance = MazeSolverUtility.Exit(maze);

            // Assert
            Assert.Equal(new Point {
                X = 7, Y = maze.Height - 1
            }, entrance);
        }
Exemple #5
0
        public void Daedelus_128x128_AStar()
        {
            // Arrange
            var maze  = ImageBasedMaze.Create("../../../../images/128x128.jpg");
            var graph = MazeSolverUtility.CreateGraph(maze);

            // Act
            IEnumerable <Point> solutionPath = Astar.Astar.Run(graph).NodeToPoint();

            maze.SavePath(solutionPath, "../../../../images/128x128_A*_solution.jpg");

            // Assert
            Assert.Equal(449, solutionPath.Count());
        }
Exemple #6
0
        public void Daedelus_63x63_Djikstra()
        {
            // Arrange
            var maze  = ImageBasedMaze.Create("../../../../images/31x31.jpg");
            var graph = MazeSolverUtility.CreateGraph(maze);

            // Act
            IEnumerable <Point> solutionPath = Djikstra.Djikstra.Run(graph).NodeToPoint();

            maze.SavePath(solutionPath, "../../../../images/31x31_Djikstra_solution.jpg");

            // Assert
            Assert.Equal(74, solutionPath.Count());
        }
Exemple #7
0
        public void SimpleMaze1_AStar()
        {
            // Arrange
            var maze  = SimpleMaze.CreateSimpleMaze1();
            var graph = MazeSolverUtility.CreateGraph(maze);

            // Act
            IEnumerable <Point> solutionPath = Astar.Astar.Run(graph).NodeToPoint();

            maze.SavePath(solutionPath, "../../../../images/SimpleMaze1_A*_solution.jpg");

            // Assert
            Assert.Equal(solutionPath, new List <Point>
            {
                new Point {
                    X = 3, Y = 0
                },
                new Point {
                    X = 3, Y = 1
                },
                new Point {
                    X = 1, Y = 1
                },
                new Point {
                    X = 1, Y = 3
                },
                new Point {
                    X = 3, Y = 3
                },
                new Point {
                    X = 3, Y = 5
                },
                new Point {
                    X = 5, Y = 5
                },
                new Point {
                    X = 5, Y = 8
                },
                new Point {
                    X = 7, Y = 8
                },
                new Point {
                    X = 7, Y = 9
                }
            });
        }
Exemple #8
0
        public void Computerphile_Djikstra()
        {
            // Arrange
            var maze  = ImageBasedMaze.Create("../../../../images/Computerphile.jpg");
            var graph = MazeSolverUtility.CreateGraph(maze);

            // Act
            IEnumerable <Point> solutionPath = Djikstra.Djikstra.Run(graph).NodeToPoint();

            maze.SavePath(solutionPath, "../../../../images/Computerphile_Djikstra_solution.jpg");

            // Assert
            Assert.Equal(solutionPath, new List <Point>
            {
                new Point {
                    X = 3, Y = 0
                },
                new Point {
                    X = 3, Y = 1
                },
                new Point {
                    X = 6, Y = 1
                },
                new Point {
                    X = 6, Y = 3
                },
                new Point {
                    X = 5, Y = 3
                },
                new Point {
                    X = 5, Y = 5
                },
                new Point {
                    X = 5, Y = 8
                },
                new Point {
                    X = 7, Y = 8
                },
                new Point {
                    X = 7, Y = 9
                }
            });
        }