public static IEnumerable <Series> GetRandomSeries(IList <Series> series)
        {
            var maxSeriesId    = BaseballScheduleHelper.MaxSeriesId(series);
            var random         = new Random();
            var randomSeriesId = random.Next(0, maxSeriesId);

            return(series.Where(s => s.SeriesId == randomSeriesId));
        }
Exemplo n.º 2
0
 public static Schedule ScheduleDivisionSeries(SeriesData scheduledSeries, Team team, IList <Team> teams, IList <Team> opponents)
 {
     foreach (var series in scheduledSeries.DivisionSeries)
     {
         var opponent = BaseballScheduleHelper.GetRandomTeamFromList(opponents);
         ScheduleGenerator.ScheduleSeries(team, opponent, series);
         opponents.Remove(opponent);
         if (!opponents.Any())
         {
             opponents = BaseballScheduleHelper.GetDivisionOpponents(team, teams);
         }
     }
     return(ScheduleGenerator.Schedule);
 }