コード例 #1
0
        static void Main(string[] args)
        {
            var fastCamel     = new FastCamel();
            var bactrianCamel = new BactrianCamel();
            var centaur       = new Centaur();
            var boots         = new MagicalBoots();
            var broom         = new Broomstick();
            var carpet        = new MagicCarpet();
            var mortar        = new Mortar();

            var allRace = new AllTransportsRace(1000);

            allRace.AddTransport(fastCamel);
            allRace.AddTransport(bactrianCamel);
            allRace.AddTransport(centaur);
            allRace.AddTransport(boots);
            allRace.AddTransport(broom);
            allRace.AddTransport(carpet);
            allRace.AddTransport(mortar);
            allRace.PrintWinner();

            var airRace = new AirTransportsRace(1000);

            airRace.AddTransport(mortar);
            airRace.AddTransport(broom);
            airRace.AddTransport(carpet);
            airRace.PrintWinner();

            var groundRace = new GroundTransportsRace(1000);

            groundRace.AddTransport(bactrianCamel);
            groundRace.AddTransport(centaur);
            groundRace.AddTransport(boots);
            groundRace.PrintWinner();
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: YaraHmltn/ITMO-OOP
        static void Main(string[] args)
        {
            Race <NanTransport> NewRace = new Race <NanTransport> (20000);


            Broom       broom       = new Broom();
            MagicCarpet magicCarpet = new MagicCarpet();
            Mortar      mortar      = new Mortar();

            Centaur         centaur       = new Centaur();
            AllTerrainBoots terrainBoots  = new AllTerrainBoots();
            BactrianCamel   bactrianCamel = new BactrianCamel();
            SpeedyCamel     speedyCamel   = new SpeedyCamel();

            NewRace.NewParticipant(centaur);
            NewRace.NewParticipant(terrainBoots);
            NewRace.NewParticipant(bactrianCamel);
            NewRace.NewParticipant(speedyCamel);

            NewRace.NewParticipant(mortar);
            NewRace.NewParticipant(broom);
            NewRace.NewParticipant(magicCarpet);

            Console.WriteLine(NewRace.GetWinner().Name);
        }