public static TeamStats getAllTeamsStats(IEnumerable <Team> teams)
        {
            var teamStats = new TeamStats();

            foreach (var team in teams)
            {
                teamStats.wins   += getGames(team, "won");
                teamStats.losses += getGames(team, "lost");
                teamStats.draws  += getGames(team, "drawn");
            }

            return(teamStats);
        }
Exemple #2
0
        public static TeamStats getRatio(StringBuilder sb)
        {
            var       str = sb.ToString();
            TeamStats ts  = new TeamStats();

            foreach (var letter in str)
            {
                if (letter == 'W')
                {
                    ts.wins = countDistinct(str, letter);
                }
                if (letter == 'D')
                {
                    ts.draws = countDistinct(str, letter);
                }
                if (letter == 'L')
                {
                    ts.losses = countDistinct(str, letter);
                }
            }
            return(ts);
        }