Ejemplo n.º 1
0
        public Solution SolveMaze(string name, int algorithm)
        {
            Solution solution = controller.GetSolution(name);

            if (!(solution == null))
            {
                return(solution);
            }

            Maze maze = controller.GetMaze(name);

            //Searcher<Position> searcher;
            Searcher <string> searcher = null;

            if (algorithm == 0)
            {
                //BFS<Position> bfs = new BFS<Position>();
                BFS <string> bfs = new BFS <string>();
                bfs.set("BFS");
                searcher = bfs;
            }
            else if (algorithm == 1)
            {
                //DFS
            }

            //MazeAdapter<Position> mazeAdapter = new MazeAdapter<Position>(maze);

            MazeAdapter <string> mazeAdapter = new MazeAdapter <string>(maze);

            //solution = searcher.search(mazeAdapter);

            solution = searcher.search(mazeAdapter);

            controller.AddSolution(name, solution);

            return(solution);
        }