/// <summary>
        /// Create a new set of teams
        /// </summary>
        /// <param name="teamCount">The number of teams to generate</param>
        public async Task CreateNewRound(int teamCount, CancellationToken cancel)
        {
            var teams = new List <Team>();

            if (Settings.Algorithm2)
            {
                var algo2 = new Algorithm2()
                {
                    LoggingOn   = Settings.LoggingOn,
                    LoggingPath = _storage.LoggingPath
                };

                teams = algo2.Generate(PlayerProvider, teamCount, Rounds.ToList());
            }
            else
            {
                var numTeamGens = Settings.NumberOfGenerations;

                var teamCreator    = new RoundCreator();
                var winnersPenalty = new TooManyWinnersPenalty(PlayerProvider);
                var penalties      = new IPenalty[] { PlayerPairings, winnersPenalty };

                teams = await teamCreator.CreateApproximatelyOptimalTeams(penalties, PlayerProvider, numTeamGens, teamCount, cancel);
            }

            var filename = _storage.GetNextHatRoundPath();

            var round = new HatRound(teams, filename);

            round.SaveToFile();

            AddRound(round);
        }
Beispiel #2
0
 private void btnOK_Click(object sender, EventArgs e)
 {
     try
     {
         this.CurrentPenalty = (IPenalty) new PenaltyClass();
         if (this.ddlPlayers.SelectedItem == null)
         {
             throw new Exception("No player selected");
         }
         if (this.ddlJudges.SelectedItem == null)
         {
             throw new Exception("No judge selected");
         }
         if (this.ddlPenalty.SelectedItem == null)
         {
             throw new Exception("No penalty selected");
         }
         if (this.ddlInfraction.SelectedItem == null)
         {
             throw new Exception("No infraction selected");
         }
         this.CurrentPenalty.Player     = (IPlayer)this.ddlPlayers.SelectedItem;
         this.CurrentPenalty.Judge      = (ITournStaff)this.ddlJudges.SelectedItem;
         this.CurrentPenalty.Infraction = ((InfractionListItem)this.ddlInfraction.SelectedItem).Value;
         this.CurrentPenalty.Penalty    = ((ListItemPenaltyEnum)this.ddlPenalty.SelectedItem).Value;
         this.CurrentPenalty.Notes      = this.txtNotes.Text;
         this.CurrentPenalty.Round      = Convert.ToInt32(this.txtRound.Text);
     }
     catch (Exception ex)
     {
         int num = (int)MessageBox.Show(ex.Message);
         return;
     }
     this.DialogResult = DialogResult.OK;
 }
Beispiel #3
0
        private void AddRow(DataTable penaltyTable, IPenalty penalty)
        {
            DataRow row = penaltyTable.NewRow();

            row["PenaltyObject"] = (object)penalty;
            row["Player"]        = (object)penalty.Player.FullName;
            row["Infraction"]    = (object)PenaltyClass.GetName(penalty.Infraction);
            row["Penalty"]       = (object)CommonEnumLists.PenaltyEnumNames[penalty.Penalty];
            row["Round"]         = (object)penalty.Round;
            row["Judge"]         = (object)penalty.Judge.FullName;
            row["Notes"]         = (object)penalty.Notes;
            penaltyTable.Rows.Add(row);
        }
Beispiel #4
0
 public Card(
     string name,
     int baseValue,
     Suits suit,
     IAction action,
     IPenalty penalty,
     IBonus bonus
     )
 {
     BaseValue = baseValue;
     Name      = name;
     Suit      = suit;
     Action    = action;
     Penalty   = penalty;
     Bonus     = bonus;
 }