public static SuggestedTournamentRound CreateRandomRound(List<Player> players) { players.Shuffle(); var round = new SuggestedTournamentRound(); var playersSittingOut = CalculatePlayersSittingOutNext(players); round.AddPlayersSittingOut(playersSittingOut); var playingPlayers = players.Except(playersSittingOut).ToList(); List<Player> remainingPlayers; var match = SuggestedMatch.CreateMatchFromFirstFirstFourPlayers(playingPlayers, out remainingPlayers); while (match != null) { round.AddMatch(match); playingPlayers = remainingPlayers; match = SuggestedMatch.CreateMatchFromFirstFirstFourPlayers(playingPlayers, out remainingPlayers); } if (remainingPlayers.Count != 0) { throw new Exception("Was not expecting any remainig players!"); } return round; }
private void AddRound(SuggestedTournamentRound currentRound) { SuggestedTournamentRounds.Add(currentRound); }