public void simulate(AbstractDuckFactory duckFactory)
        {
            IQuackable redheadDuck = duckFactory.createRedheadDuck();
            IQuackable duckCall    = duckFactory.createDuckCall();
            IQuackable rubberDuck  = duckFactory.createRubberDuck();
            IQuackable gooseDuck   = new GooseAdapter(new Goose());

            Flock flockOfDucks = new Flock();

            flockOfDucks.add(redheadDuck);
            flockOfDucks.add(duckCall);
            flockOfDucks.add(rubberDuck);
            flockOfDucks.add(gooseDuck);


            IQuackable mallard1 = duckFactory.createMallardDuck();
            IQuackable mallard2 = duckFactory.createMallardDuck();
            IQuackable mallard3 = duckFactory.createMallardDuck();
            IQuackable mallard4 = duckFactory.createMallardDuck();

            Flock flockOfMallards = new Flock();

            flockOfMallards.add(mallard1);
            flockOfMallards.add(mallard2);
            flockOfMallards.add(mallard3);
            flockOfMallards.add(mallard4);

            flockOfDucks.add(flockOfMallards);

            Console.WriteLine("\n.......Duck simulator.......");

            Console.WriteLine("\nDuck Simulator: Mallard Flock Simulation: ");
            simulate(flockOfMallards);

            Console.WriteLine("\nDuck Simulator: With Observer:");
            Quackologist quackologist = new Quackologist();

            flockOfDucks.registerObserver(quackologist);
            simulate(flockOfDucks);

            Console.WriteLine("\nThe ducks quacked: " + QuackCounter.GetQuacks());
        }
        public void simulate(AbstractDuckFactory factory)
        {
            Quackable redhead = factory.createRedheadDuck();
            Quackable call    = factory.createDuckCall();
            Quackable rubber  = factory.createRubberDuck();
            Quackable goose   = new GooseAdapter(new Goose());

            Console.WriteLine("Duck Simulator: With Composite - Flocks");

            Flock flockOfDucks = new Flock();

            flockOfDucks.add(redhead);
            flockOfDucks.add(call);
            flockOfDucks.add(rubber);
            flockOfDucks.add(goose);

            Flock flockOfMallards = new Flock();

            Quackable mallard1 = factory.createMallardDuck();
            Quackable mallard2 = factory.createMallardDuck();
            Quackable mallard3 = factory.createMallardDuck();
            Quackable mallard4 = factory.createMallardDuck();

            flockOfMallards.add(mallard1);
            flockOfMallards.add(mallard2);
            flockOfMallards.add(mallard3);
            flockOfMallards.add(mallard4);

            flockOfDucks.add(flockOfMallards);

            Console.WriteLine("Duck Simulator: Whole Flock Simulation");
            simulate(flockOfDucks);
            Console.WriteLine("Duck Simulator: Mallard Flock Simulation");
            simulate(flockOfMallards);

            Console.WriteLine("The ducks quacked " + QuackCounter.getQuacks() + " times");
        }