public TeamTournamentStats(TournamentSeason tournamentSeason, Team team) { TournamentSeason = tournamentSeason; Team = team; PlayerStats = new List<PlayerTournamentStats>(); }
public Fixture[] CreateFixtures(TournamentSeason tournamentSeason) { var firstLeg = new Fixture(tournamentSeason, FirstLegDate, Team1, Team2, false, false); var secondLeg = new Fixture(SecondLegDate, firstLeg); return new Fixture[] { firstLeg, secondLeg }; }
public IEnumerable<Fixture> ScheduleLeagueFixtures(TournamentSeason season, IEnumerable<Team> teams, DateTime startDate, DateTime endDate, DayOfWeek dayOfWeek, int frequency, bool hasReturnRound = true) { int roundCount = CalculateRoundCount(teams.Count()); int stage1RoundCount = hasReturnRound ? roundCount : roundCount / 2 + 1; int stage2RoundCount = hasReturnRound ? roundCount : roundCount - stage1RoundCount; var dates = ScheduleRoundDates(startDate, endDate, dayOfWeek, frequency, stage1RoundCount, stage2RoundCount); return ScheduleLeagueFixtures(season, dates, hasReturnRound, teams); }
private IEnumerable<Fixture> ScheduleRoundFixtures(TournamentSeason season, DateTime date, int round, bool isReturnRound, IEnumerable<Team> teams) { int count; var fixtures = new List<Fixture>(); Team restingTeam = teams.ElementAt(round); Team lastTeam = null; if (teams.Count() % 2 == 0) { count = teams.Count() - 1; lastTeam = teams.Last(); } else { count = teams.Count(); } for (int i = 1; i <= (count - 1) / 2; i++) { Team team1 = teams.ElementAt((round + i) % count); Team team2 = teams.ElementAt((round + count - i) % count); if (round % 2 == (isReturnRound ? 1 : 0)) { fixtures.Add(new Fixture(season, date, team1, team2, false, false)); } else { fixtures.Add(new Fixture(season, date, team2, team1, false, false)); } } if (lastTeam != null) { if (round % 2 == (isReturnRound ? 1 : 0)) { fixtures.Add(new Fixture(season, date, lastTeam, restingTeam, false, false)); } else { fixtures.Add(new Fixture(season, date, restingTeam, lastTeam, false, false)); } } return random.Sort(fixtures); }
public IEnumerable<Fixture> ScheduleLeagueFixtures(TournamentSeason season, IEnumerable<DateTime> dates, bool hasReturnRound, IEnumerable<Team> teams) { int round = 0; int roundCount = CalculateRoundCount(teams.Count()); teams = random.Sort(teams); var fixtures = new List<Fixture>(); foreach (var date in dates) { var roundFixtures = ScheduleRoundFixtures(season, date, round % roundCount, hasReturnRound && round >= roundCount, teams); fixtures.AddRange(roundFixtures); round++; } return fixtures; }
public IEnumerable<Fixture> CreateFixtures(TournamentSeason season, IEnumerable<DateTime> dates) { var scheduler = new Scheduler(); return scheduler.ScheduleLeagueFixtures(season, dates, HasReturnRound, Teams); }
public PlayerTournamentStats(TournamentSeason tournamentSeason, Player player) { TournamentSeason = tournamentSeason; Player = player; PlayerName = player.Name; }
public void AddDivisionSeason(TournamentSeason divisionSeason) { Divisions.Add(divisionSeason); }
private IEnumerable<TeamPair> CreatePairsForDivisions(TournamentSeason division, TournamentSeason lowerDivision) { return Enumerable.Zip(division.RelegationPlayOffTeams, lowerDivision.PromotionPlayOffTeams.AsEnumerable().Reverse(), (t1, t2) => new TeamPair(t2, t1)).ToArray(); }
public Fixture(TournamentSeason tournamentSeason, DateTime date, Team team1, Team team2, bool isNeutralGround, bool requiresExtraTime) : this(tournamentSeason.World, tournamentSeason.Id, date, team1, team2, isNeutralGround, requiresExtraTime) { }