Beispiel #1
0
        static void Main()
        {
            // Get the red and blue factories (configured via Spring)
            IApplicationContext ctx = ContextRegistry.GetContext();
            ShipFactory redFactory = (ShipFactory)ctx.GetObject("RedFactory");
            ShipFactory blueFactory = (ShipFactory) ctx.GetObject("BlueFactory");

            BattleSimulator sim = new BattleSimulator(redFactory, blueFactory, 5);

            Console.WriteLine("Opening State:");
            Console.WriteLine(sim.Battlefield.ToString());
            sim.Fight();
            sim.Battlefield.ReportResultToConsole();
            Console.WriteLine("[Press Enter to Exit]");
            Console.ReadLine();
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            //            BattleSimulator sim = new BattleSimulator(
            //                new MartianShipFactory(),
            //                new TerranShipFactory(), 5);

            BattleSimulator sim = new BattleSimulator(
                new TerranShipFactory(),
                new PirateShipFactory(),  5);
            //BattleSimulator sim = new BattleSimulator(new MartianShipFactory(), new PirateShipFactory(), 5);

            Console.WriteLine("Opening State:");
            Console.WriteLine(sim.Battlefield.ToString());
            sim.Fight();
            sim.Battlefield.ReportResultToConsole();
            Console.WriteLine("[Press Enter to Exit]");
            Console.ReadLine();
        }