コード例 #1
0
ファイル: game.cs プロジェクト: tdukaric/Design-Patterns
        /// <summary>
        /// Plays the specified arguments.
        /// </summary>
        /// <param name="args">The arguments.</param>
        static public void play(string[] args)
        {
            string fileName = args[0];
            int intervalSeconds;
            int controlInterval;
            int limit = 2;
            CareTakerTeams takerTeam = new CareTakerTeams();
            CareTakerResults takerResults = new CareTakerResults();
            CareTakerTeams takerTeamDifferences = new CareTakerTeams();
            
            if(!Int32.TryParse(args[1], out intervalSeconds))
            {
                Console.WriteLine("Can't parse second parameter.");
                return;
            }

            if(!Int32.TryParse(args[2], out controlInterval))
            {
                Console.WriteLine("Can't parse third parameter.");
                return;
            }

            if(!Int32.TryParse(args[3], out limit))
            {
                Console.WriteLine("Can't parse fourth parameter.");
                return;
            }

            load temp = new load(fileName, limit);
            teams t = new teams(temp.getTeams());
            match m = new match(t.ranking, takerTeam, takerTeamDifferences, takerResults);
            m.play(controlInterval, intervalSeconds, limit);
            //t.update();
            t.sort();
            Console.WriteLine();
            Console.WriteLine();

        }
コード例 #2
0
        /// <summary>
        /// Plays the specified arguments.
        /// </summary>
        /// <param name="args">The arguments.</param>
        static public void play(string[] args)
        {
            string           fileName = args[0];
            int              intervalSeconds;
            int              controlInterval;
            int              limit                = 2;
            CareTakerTeams   takerTeam            = new CareTakerTeams();
            CareTakerResults takerResults         = new CareTakerResults();
            CareTakerTeams   takerTeamDifferences = new CareTakerTeams();

            if (!Int32.TryParse(args[1], out intervalSeconds))
            {
                Console.WriteLine("Can't parse second parameter.");
                return;
            }

            if (!Int32.TryParse(args[2], out controlInterval))
            {
                Console.WriteLine("Can't parse third parameter.");
                return;
            }

            if (!Int32.TryParse(args[3], out limit))
            {
                Console.WriteLine("Can't parse fourth parameter.");
                return;
            }

            load  temp = new load(fileName, limit);
            teams t    = new teams(temp.getTeams());
            match m    = new match(t.ranking, takerTeam, takerTeamDifferences, takerResults);

            m.play(controlInterval, intervalSeconds, limit);
            //t.update();
            t.sort();
            Console.WriteLine();
            Console.WriteLine();
        }