Exemple #1
0
 public void CreateAdjacentsSuccess()
 {
     Maze.Maze maze = new Maze.Maze(5, 5);
     Common common = new Common();
     common.CreateAdjacents(maze);
     Assert.AreNotEqual(0, maze.Grid[0, 0].Adjacents.Count);
 }
Exemple #2
0
        private void CreateMaze(int rows, int columns)
        {
            Maze = new Maze(rows, columns);

            _common = new Common();
            _common.CreateAdjacents(Maze);

            ConfigurationManager.RefreshSection(SECTION);
            string algorithm = ConfigurationManager.AppSettings[ALGORITHM_SECTION];

            if(algorithm.Equals(PRIM))
                Maze.SetMazeCreationStrategy(new PrimsAlgorithm(Maze));
            else if(algorithm.Equals(RECURSIVE_BACKTRACKING))
                Maze.SetMazeCreationStrategy(new RecursiveBacktrackingAlgorithm(Maze));
            else if (algorithm.Equals(CUSTOM))
                Maze.SetMazeCreationStrategy(new CustomAlgorithm(Maze));

            Maze.CreateMaze();

            PrintMaze();
        }
Exemple #3
0
        public void FindEndSuccess()
        {
            Maze.Maze maze = new Maze.Maze(10, 10);
            Common common = new Common();
            common.CreateAdjacents(maze);
            maze.SetMazeCreationStrategy(new PrimsAlgorithm(maze));

            string output = System.Environment.NewLine;
            for (int i = maze.Rows-1; i >= 0; i--)
            {
                for (int j = maze.Columns-1; j >= 0; j--)
                {
                    if (maze.Grid[i, j].CellState == CELL_STATE.OPEN)
                        output += "|O|";
                    else
                        output += "|X|";
                }
                output += System.Environment.NewLine;
            }

            Logger.Instance.Log(output);

            Assert.AreEqual(1, 1);
        }