示例#1
0
 public CustomAlgorithm(Maze maze)
 {
     _common = new Common();
     _common.Rand = new Random((int)DateTime.Now.Ticks);
     _common.EndReached = false;
     _common.Maze = maze;
     _common.Stack = new Stack<Cell>();
 }
示例#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();
        }
示例#3
0
 public PrimsAlgorithm(Maze maze)
 {
     _common = new Common();
     _common.Rand = new Random((int)DateTime.Now.Ticks);
     _common.EndReached = false;
     _common.Maze = maze;
 }