Пример #1
0
        static void Main(string[] args)
        {
            var mazeDirector = new MazeGame(new StandardMazeBuilder());
            var maze         = mazeDirector.CreateMaze();

            var anotherMazeDirector = new MazeGame(new CountingMazeBuilder());
            var anotherMaze         = anotherMazeDirector.CreateMaze();
        }
Пример #2
0
        private static void StandartInstance()
        {
            Maze                maze;
            MazeGame            mazeGame = new MazeGame();
            StandartMazeBuilder builder  = new StandartMazeBuilder();

            mazeGame.CreateMaze(builder);

            maze = builder.GetMaze();
        }
Пример #3
0
        private static void CountingInstance()
        {
            int rooms, doors;

            Maze                maze;
            MazeGame            game    = new MazeGame();
            CountingMazeBuilder builder = new CountingMazeBuilder();

            game.CreateMaze(builder);

            maze = builder.GetMaze();
            builder.GetCounts(out rooms, out doors);

            Console.WriteLine($"Rooms: {rooms}, Doors: {doors}");
        }