コード例 #1
0
ファイル: match.cs プロジェクト: tdukaric/Design-Patterns
        /// <summary>
        /// Initializes a new instance of the <see cref="match"/> class.
        /// </summary>
        /// <param name="ranking">The ranking.</param>
        /// <param name="takerTeam">The taker team.</param>
        /// <param name="takerTeamDiff">The taker team difference.</param>
        /// <param name="takerRez">The taker rez.</param>
        public match(List<team> ranking, CareTakerTeams takerTeam, CareTakerTeams takerTeamDiff, CareTakerResults takerRez)
        {
            this.teams = new List<team>();
            foreach (team tim in ranking)
            {
                tim.round_points = 0;
                teams.Add(tim);
            }
            this.takerTeam = takerTeam;
            this.takerRez = takerRez;
            this.takerTeamDiff = takerTeamDiff;

            PrintEfListener listen = new PrintEfListener();
            h += new handler(listen.Print);
        }
コード例 #2
0
ファイル: match.cs プロジェクト: tdukaric/Design-Patterns
        /// <summary>
        /// Initializes a new instance of the <see cref="match"/> class.
        /// </summary>
        /// <param name="ranking">The ranking.</param>
        /// <param name="takerTeam">The taker team.</param>
        /// <param name="takerTeamDiff">The taker team difference.</param>
        /// <param name="takerRez">The taker rez.</param>
        public match(List <team> ranking, CareTakerTeams takerTeam, CareTakerTeams takerTeamDiff, CareTakerResults takerRez)
        {
            this.teams = new List <team>();
            foreach (team tim in ranking)
            {
                tim.round_points = 0;
                teams.Add(tim);
            }
            this.takerTeam     = takerTeam;
            this.takerRez      = takerRez;
            this.takerTeamDiff = takerTeamDiff;

            PrintEfListener listen = new PrintEfListener();

            h += new handler(listen.Print);
        }
コード例 #3
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();

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