Example #1
0
        public void SolveMaze(IMaze maze, ISolveMazes solver)
        {
            _ = maze ?? throw new ArgumentNullException(nameof(maze));
            _ = solver ?? throw new ArgumentNullException(nameof(solver));

            solver.Solve(maze, maze.Grid[0]);
        }
Example #2
0
        public SolvedMaze GenerateCarveAndSolve(Type algorithm,
                                                ISolveMazes solver,
                                                int width  = Maze.DEFAULT_WIDTH,
                                                int height = Maze.DEFAULT_WIDTH)
        {
            _ = algorithm ?? throw new ArgumentNullException(nameof(algorithm));
            _ = solver ?? throw new ArgumentNullException(nameof(solver));

            var maze = GenerateMaze(width, height);
            var algo = CreateAlgorithm(algorithm);

            return(new SolvedMaze((Maze)maze, algo, solver));
        }
Example #3
0
        public SolvedMaze(Maze maze, IAlgorithm algorithm, ISolveMazes solver)
        {
            _ = maze ?? throw new ArgumentNullException(nameof(maze));
            _ = algorithm ?? throw new ArgumentNullException(nameof(algorithm));
            _ = solver ?? throw new ArgumentNullException(nameof(solver));

            this.maze = maze;
            Algorithm = algorithm;
            Solver    = solver;

            Algorithm.Carve(maze);
            Solver.Solve(maze, Grid[0]);
        }
        public DrawConsoleDistances(ISolveMazes solver)
        {
            _ = solver ?? throw new ArgumentNullException(nameof(solver));

            this.solver = solver;
        }