コード例 #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}");
        }