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>(); }
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(); }
public PrimsAlgorithm(Maze maze) { _common = new Common(); _common.Rand = new Random((int)DateTime.Now.Ticks); _common.EndReached = false; _common.Maze = maze; }