public void ExecuteApplication()
        {
            int verticalLenght   = 0;
            int horizontalLenght = 0;

            ShowMazeAppHeaderAndGetInput(ref verticalLenght, ref horizontalLenght);
            string menuOption    = "G";
            IMaze  generatedMaze = null;

            do
            {
                switch (menuOption)
                {
                case "G":
                    generatedMaze = _iMazeGenerator.GenerateMaze(horizontalLenght, verticalLenght);
                    _iDrawMazeService.DrawMaze(generatedMaze, false);
                    break;

                case "S":
                    _iDrawMazeService.DrawMaze(generatedMaze, true);
                    break;
                }

                Console.WriteLine("Press S to show the correct way of the maze");
                Console.WriteLine("Press G to generate a new Maze with same dimentions.");
                Console.WriteLine("Press any other key to exit.");
                menuOption = Console.ReadLine().ToUpper();
            } while (menuOption == "G" || menuOption == "S");
        }
예제 #2
0
        public void GenerateMaze_ValidArguments_RoomsArrayIsSizeSquaredInLength(int gridsize, int expectedRoomsLength)
        {
            rg = new MockRandomGeneratorMin();
            var(rooms, _, _) = mg.GenerateMaze(rg, gridsize);

            Assert.Equal(expectedRoomsLength, rooms.Length);
        }
예제 #3
0
        private static void CreateAndShowMaze(IMazeGenerator generator)
        {
            generator.GenerateMaze();

            var textMaze = generator.GetTextMaze(true);

            Console.WriteLine(textMaze);

            var graphicMaze = generator.GetGraphicalMaze(true);

            graphicMaze.Save("maze.png");
            Process p = new Process();

            p.StartInfo.FileName = "maze.png";
            p.Start();
        }
예제 #4
0
        private static void CreateAndShowMaze(IMazeGenerator generator)
        {
            generator.GenerateMaze();

            string textMaze = generator.GetTextMaze(true);

            Console.WriteLine(textMaze);

            Bitmap graphicMaze = generator.GetGraphicalMaze(true);

            graphicMaze.Save("maze.png", ImageFormat.Png);
            Process p = new Process();

            p.StartInfo.UseShellExecute = true;
            p.StartInfo.FileName        = "maze.png";
            p.Start();
        }
예제 #5
0
        private static void CreateAndShowMaze(IMazeGenerator generator)
        {
            generator.GenerateMaze();

            var textMaze = generator.GetTextMaze(true);

            Console.WriteLine(textMaze);

            var graphicMaze = generator.GetGraphicalMaze(true);

            graphicMaze.Save("maze.png");

            // This code is Windows-only
            // Comment out the following if building on macOS or Linux
            // The "maze.png" file can be located in the output
            // folder: [solutionlocation]/DrawMaze/bin/Debug/netcore3.1/
            Process p = new Process();

            p.StartInfo.UseShellExecute = true;
            p.StartInfo.FileName        = "maze.png";
            p.Start();
        }
예제 #6
0
 public void StartNew(Coordinate startAt)
 {
     _maze = _mazeGenerator.GenerateMaze(startAt);
     _maze.Draw();
 }
 public void GenerateMaze()
 {
     LogEnterMethod();
     wrappedGenerator.GenerateMaze();
     LogExitMethod();
 }