示例#1
0
        static void Main(string[] args)
        {
            //input data from user
            string path = PromptForValidFile("please enterthe  maze file path :");
            int    maxPathsToFoundCnt = PromptForValidNumber("please enter the maximum paths to find :");

            //path = "c:\\maze / maze.txt"
            //maxPathsFound = 10000;

            //prepare maze generator and solver
            MazeGeneratorFromTxt mazeGenaratorFromTxt = new MazeGeneratorFromTxt(path);
            MazeSolver           mazeSolver           = new MazeSolver(maxPathsToFoundCnt);

            //instatiate mazecoordinator
            MazeCoordinator mazeCoordinator = new MazeCoordinator(mazeGenaratorFromTxt, mazeSolver);

            string errorMessage;

            //call in order to find available paths in maze
            mazeCoordinator.MazePaths(out errorMessage);

            //if errorMessage exists then show message
            if (errorMessage != null && errorMessage.Length > 0)
            {
                Console.WriteLine(errorMessage);
            }

            Console.ReadLine();
        }
示例#2
0
        public void FindPaths_Maze_ReturnNoPath()
        {
            int        maxPathsFind = 100;
            int        expectedRows = 0;
            MazeSolver mazesolver   = new MazeSolver(maxPathsFind);

            List <List <Node> > _paths = mazesolver.FindPaths(ProvideMazewithNoPaths());

            Assert.AreEqual(expectedRows, _paths.Count);
        }