private void buttonAdd_Click(object sender, EventArgs e)
        {
            try
            {
                string   matchupId    = textBoxId.Text;
                int      matchupRound = int.Parse(textBoxRound.Text);
                DateTime matchupDate  = dateTimePickerMatchup.Value;

                Matchups mat = new Matchups(matchupId, matchupRound, matchupDate);
                Matchups.AddMatchup(mat);

                Teams team1 = (Teams)comboBoxTeam1.SelectedItem;
                Teams team2 = (Teams)comboBoxTeam2.SelectedItem;


                double team1AddScore = double.Parse(textBoxScore1.Text);
                double team2AddScore = double.Parse(textBoxScore2.Text);

                MatchupEntries.Add(mat, team1, team1AddScore);
                MatchupEntries.Add(mat, team2, team2AddScore);

                team1.AddScore(team1AddScore);
                team2.AddScore(team2AddScore);

                MessageBox.Show("Matchup has been Saved", "Information");
            }
            catch (Exception ex)
            {
                MessageBox.Show("Matchups cannot be saved. Error Message: " + ex.Message, "Error");
            }
        }
        private void buttonDelete_Click(object sender, EventArgs e)
        {
            DialogResult confirm = MessageBox.Show("Matchup akan didelete, Apakah anda yakin?", "Confirm", MessageBoxButtons.YesNo);

            if (confirm == System.Windows.Forms.DialogResult.Yes)
            {
                int    matchupSelectedIndex = dataGridViewMatchup.CurrentCell.RowIndex;
                string selectedMatchupId    = dataGridViewMatchup.Rows[matchupSelectedIndex].Cells[0].Value.ToString();

                selectedMatchup = Matchups.SelectMatchup(selectedMatchupId);

                List <MatchupEntries> pair = Matchups.GetEntries(selectedMatchup);
                selectedMatchupEntry1 = pair[0];
                selectedMatchupEntry2 = pair[1];

                MatchupEntries.Delete(selectedMatchup, selectedMatchupEntry1.Team);
                MatchupEntries.Delete(selectedMatchup, selectedMatchupEntry2.Team);

                Matchups.DeleteMatchup(selectedMatchup);

                MessageBox.Show("Delete successful.");
            }
            else
            {
                MessageBox.Show("Delete matchup canceled.");
            }
        }
        private void textBoxSearchMatchup_TextChanged(object sender, EventArgs e)
        {
            // Player search query with criteria
            matchupList = Matchups.ReadData(FormMenu.selectedTournament);

            // Refresh datagridplayer
            ShowDataGridMatchup();
        }
        public void FormMatch_Load(object sender, EventArgs e)
        {
            //Menampilkan Data dari database tabel matchup
            FormatDataGridMatchup();
            matchupList = Matchups.ReadData(FormMenu.selectedTournament);
            ShowDataGridMatchup();

            //Menampilkan Data dari database tabel matchupEntries
            FormatDataGridMatchupEntries();
            entryList = MatchupEntries.ReadData(FormMenu.selectedTournament);
            ShowDataGridMatchupEntries();
        }
Пример #5
0
        private void UpdateMatchups()
        {
            Matchups.Clear();

            foreach (string playerFaction in MainFactionList)
            {
                foreach (string opponentFaction in MainFactionList)
                {
                    CalculateMatchup(playerFaction, opponentFaction);
                }
            }
        }
Пример #6
0
        private void AddMatchup(string playerFaction, string opponentFaction, int wins, int totalGamesPlayed)
        {
            Matchup matchup = new Matchup()
            {
                PlayerFaction   = playerFaction,
                OpponentFaction = opponentFaction,
                MatchesWon      = wins,
                MatchesLost     = totalGamesPlayed - wins,
                Winrate         = Math.Round((double)wins / totalGamesPlayed, 2)
            };

            Matchups.Add(matchup);
        }
        /// <summary>
        /// Resets the Bracket.
        /// Affects Matches, Rankings, and bracket status.
        /// Also resets the private Matchups and PlayerByes lists.
        /// </summary>
        protected override void ResetBracketData()
        {
            base.ResetBracketData();

            ActiveRound = 0;
            if (null == Matchups)
            {
                Matchups = new List <Matchup>();
            }
            if (null == PlayerByes)
            {
                PlayerByes = new List <int>();
            }
            Matchups.Clear();
            PlayerByes.Clear();
        }
        private void buttonEditMatchup_Click(object sender, EventArgs e)
        {
            int    matchupSelectedIndex = dataGridViewMatchup.CurrentCell.RowIndex;
            string selectedMatchupId    = dataGridViewMatchup.Rows[matchupSelectedIndex].Cells[0].Value.ToString();

            selectedMatchup = Matchups.SelectMatchup(selectedMatchupId);

            List <MatchupEntries> pair = Matchups.GetEntries(selectedMatchup);

            selectedMatchupEntry1 = pair[0];
            selectedMatchupEntry2 = pair[1];

            FormEditMatchup formEditMatchup = new FormEditMatchup();

            formEditMatchup.Owner = this;
            formEditMatchup.ShowDialog();
        }
        private void FormAddMatchup_Load(object sender, EventArgs e)
        {
            listTeam1 = TournamentEntry.ReadTeam(FormMenu.selectedTournament, "");
            listTeam2 = TournamentEntry.ReadTeam(FormMenu.selectedTournament);

            comboBoxTeam1.DataSource = listTeam1;
            comboBoxTeam2.DataSource = listTeam2;

            comboBoxTeam1.DisplayMember = "Name";
            comboBoxTeam2.DisplayMember = "Name";

            comboBoxTeam1.DropDownStyle = ComboBoxStyle.DropDownList;
            comboBoxTeam1.DropDownStyle = ComboBoxStyle.DropDownList;

            string newCode = Matchups.GenerateId();

            textBoxId.Text = newCode;
        }
Пример #10
0
        public double GetGameWinPercentage(bool withByes = true)
        {
            IEnumerable <Matchup> matchups;

            if (withByes)
            {
                matchups = this.Matchups;
            }
            else
            {
                matchups = Matchups.Where(n => !(n.Match.Matchups.Any(mn => mn.Player.Name == "BYE")));
            }

            double result = (double)matchups.Sum(n => n.Wins * 3 + n.Ties) / (double)(matchups.Sum(n => n.Wins + n.Ties + n.Losses) * 3);

            // Lower limit of game-win percentage set to 0.33 by MTG Tournament Rules
            return(Math.Max(result, 0.33));
        }
Пример #11
0
        public double GetMatchWinPercentage(bool withByes = true)
        {
            IEnumerable <Matchup> matchups;

            if (withByes)
            {
                matchups = this.Matchups;
            }
            else
            {
                matchups = Matchups.Where(n => !(n.Match.Matchups.Any(mn => mn.Player.Name == "BYE")));
            }

            var result = (double)(matchups.Count(n => n.DidWin == true) * 3 + matchups.Count(n => n.DidTie)) / (double)(matchups.Count() * 3);

            // Lower limit of match-win percentage set to 0.33 by MTG Tournament Rules
            return(Math.Max(result, 0.33));
        }
        private void LoadMatchups()
        {
            foreach (List <MatchupModel> matchups in Tournament.Rounds)
            {
                if (matchups.First().MatchupRound == SelectedRound)
                {
                    Matchups.Clear();
                    foreach (MatchupModel m in matchups)
                    {
                        if (m.Winner == null || !UnplayedOnly)
                        {
                            Matchups.Add(m);
                        }
                    }
                }
            }

            if (Matchups.Count > 0)
            {
                SelectedMatchup = Matchups.First();
            }
        }
Пример #13
0
        private void ButtonEdit_Click(object sender, EventArgs e)
        {
            try
            {
                string   matchupId    = textBoxId.Text;
                int      matchupRound = int.Parse(textBoxRound.Text);
                DateTime matchupDate  = dateTimePickerMatchup.Value;

                Matchups matchup = new Matchups(matchupId, matchupRound, matchupDate);
                Matchups.EditMatchup(matchup);

                Teams team1 = (Teams)comboBoxTeam1.SelectedItem;
                Teams team2 = (Teams)comboBoxTeam2.SelectedItem;

                double team1NewEntryScore = double.Parse(textBoxScore1.Text);
                double team2NewEntryScore = double.Parse(textBoxScore2.Text);

                MatchupEntries.Edit(matchup, team1, team1NewEntryScore);
                MatchupEntries.Edit(matchup, team2, team2NewEntryScore);

                double oldTeam1EntryScore = FormMatch.selectedMatchupEntry1.Score;
                double oldTeam2EntryScore = FormMatch.selectedMatchupEntry2.Score;

                team1.SubstractScore(oldTeam1EntryScore);
                team2.SubstractScore(oldTeam2EntryScore);

                team1.AddScore(team1NewEntryScore);
                team2.AddScore(team2NewEntryScore);

                MessageBox.Show("Matchup has been Saved", "Information");
            }
            catch (Exception ex)
            {
                MessageBox.Show("Fail to edit matchup, " + ex.Message, "Error");
            }
        }
        /// <summary>
        /// Resets every round after the given round index.
        /// This removes the Players from every affected Match,
        /// in addition to resetting their Games and scores.
        /// Will NOT remove the Players from round 1, even if passed a 0.
        /// Sets ActiveRound to the given round index.
        /// May fire MatchesModified and GamesDeleted events, if updates occur.
        /// If _currentRoundIndex is out of range, nothing is modified.
        /// </summary>
        /// <param name="_currentRoundIndex">Reset all rounds after this index</param>
        /// <returns>List of Models of altered Matches</returns>
        private List <MatchModel> RemoveFutureRounds(int _currentRoundIndex)
        {
            List <MatchModel> clearedMatches = new List <MatchModel>();
            List <int>        deletedGameIDs = new List <int>();

            int nextRoundIndex = 1 + _currentRoundIndex;

            if (nextRoundIndex > NumberOfRounds)
            {
                // Recursive exit: we've reached the final round.
                return(clearedMatches);
            }

            // Recursive call on all rounds after this one:
            clearedMatches.AddRange(RemoveFutureRounds(nextRoundIndex));

            if (_currentRoundIndex >= 0)
            {
                // Reset all Matches in this round:
                List <IMatch> nextRound = GetRound(nextRoundIndex);
                foreach (Match match in nextRound)
                {
                    if (!(match.Players.Contains(null)) ||
                        match.Games.Count > 0 ||
                        match.IsManualWin)
                    {
                        deletedGameIDs.AddRange(match.Games.Select(g => g.Id));
                        if (nextRoundIndex > 1)
                        {
                            // Remove the Players (and reset score & Games):
                            match.ResetPlayers();
                        }
                        else
                        {
                            // Keep Players if Round = 1 (still reset score):
                            match.ResetScore();
                        }

                        // Save a Model of the updated Match:
                        clearedMatches.Add(GetMatchModel(match));
                    }
                }
                if (nextRoundIndex > 1)
                {
                    // For all rounds after 1,
                    // delete associated Matchups and Bye:
                    Matchups.RemoveAll(m => m.RoundNumber == nextRoundIndex);
                    if (PlayerByes.Count == nextRoundIndex)
                    {
                        // Remove the last Bye in the list:
                        PlayerByes.RemoveAt(PlayerByes.Count - 1);
                    }

                    // Update bracket Properties:
                    ActiveRound = _currentRoundIndex;
                }

                // Fire notification event: Games were deleted.
                OnGamesDeleted(deletedGameIDs);
            }

            // Return a list of modified MatchModels:
            return(clearedMatches);
        }
Пример #15
0
 public int GetGameTies()
 {
     return(Matchups.Sum(n => n.Ties));
 }
Пример #16
0
 public int GetGameLosses()
 {
     return(Matchups.Sum(n => n.Losses));
 }
Пример #17
0
 public int GetGameWins()
 {
     return(Matchups.Sum(n => n.Wins));
 }
Пример #18
0
 public int GetMatchTies()
 {
     return(Matchups.Where(n => n.DidTie == true).Count());
 }
Пример #19
0
 public int GetMatchLosses()
 {
     return(Matchups.Where(n => n.DidWin == false && n.DidTie == false).Count());
 }
Пример #20
0
 public int GetMatchWins()
 {
     return(Matchups.Where(n => n.DidWin == true).Count());
 }
        /// <summary>
        /// Attempts to create a new round of (legal) Swiss matchups.
        /// This takes all prior results into account for the following:
        /// - Match strong players together, and weak players together.
        /// - No rematches.
        /// - No repeat byes.
        /// If a new legal round is created, the next Bracket round is populated.
        /// </summary>
        /// <param name="_gamesPerMatch">Max Games for each Match</param>
        /// <returns>true on success, false on failure</returns>
        private bool AddSwissRound(int _gamesPerMatch)
        {
            // Don't try to populate nonexistent rounds:
            if (ActiveRound >= NumberOfRounds)
            {
                return(false);
            }

            #region Swiss Algorithm
            // CreateGroups() divides players into "groups"
            // based on their W/L record.
            List <List <int> > scoreBrackets = CreateGroups();

            // GetHeuristicEdges() generates a graph representing
            // matchup preferences between every player.
            // Players with the same record and no prior matchups
            // will have a very low heuristic value here.
            List <int[]> possibleMatches = GetHeuristicEdges(scoreBrackets);

            // Access the Python weight-matching script:
            var engine = IronPython.Hosting.Python.CreateEngine();
            var scope  = engine.CreateScope();
            engine.ExecuteFile("mwmatching.py", scope);
            dynamic maxWeightMatching = scope.GetVariable("maxWeightMatching");

            // Calling maxWeightMatching returns a Swiss matchup solution (if possible).
            // The resulting list is a list of legal matchups:
            IronPython.Runtime.List pySolution = maxWeightMatching(possibleMatches, true);
            #endregion

            #region Legal Checks
            // Double-check that all the new matchups are Swiss-legal.
            // Create a list of all the new Matchups:
            List <Matchup> newRoundMatchups = new List <Matchup>();
            for (int i = 0; i < pySolution.Count; ++i)
            {
                // 'i' = 'Defender index'
                // 'pySolution[i]' = 'Challenger index'
                int challengerIndex = Convert.ToInt32(pySolution[i]);
                if (i == challengerIndex)
                {
                    // Player is matched against himself!
                    return(false);
                }
                else if (i > challengerIndex)
                {
                    continue;
                }

                Matchup newMatchup = new Matchup(i, challengerIndex, (1 + ActiveRound));
                foreach (Matchup m in Matchups)
                {
                    if (m.HasMatchingPlayers(newMatchup))
                    {
                        // This is a rematch from a previous round!
                        return(false);
                    }
                }
                foreach (Matchup m in newRoundMatchups)
                {
                    if (m.ContainsInt(newMatchup.DefenderIndex) ||
                        m.ContainsInt(newMatchup.ChallengerIndex))
                    {
                        // A player has multiple matchups this round!
                        return(false);
                    }
                }
                newRoundMatchups.Add(newMatchup);
            }
            if (newRoundMatchups.Count < (int)(Players.Count * 0.5))
            {
                // Not enough Matchups were created!
                // (probably means: unable to create enough legal matches)
                return(false);
            }
            #endregion

            #region New Round Populating
            // CONFIRMED LEGAL!
            // Populate the next round of Matches with these Players:
            for (int i = 0; i < newRoundMatchups.Count; ++i)
            {
                int matchNum = (i + 1 + (newRoundMatchups.Count * ActiveRound));

                Matches[matchNum].AddPlayer(Players[newRoundMatchups[i].DefenderIndex]);
                Matches[matchNum].AddPlayer(Players[newRoundMatchups[i].ChallengerIndex]);
            }
            ++ActiveRound;

            // Add the new Matchups to our matchups list:
            Matchups.AddRange(newRoundMatchups);

            // Now that we have a new legal round...
            // Award points to the player with a bye, if there is one:
            if (PlayerByes.Count > 0)
            {
                int rIndex = Rankings.FindIndex(r => r.Id == PlayerByes[PlayerByes.Count - 1]);
                Rankings[rIndex].AddMatchOutcome(Outcome.Win, true);
                UpdateRankings();
            }
            #endregion

            return(true);
        }
Пример #22
0
        public void Initialize()
        {
            int i;
            int x = Padding, y = Padding;

            for (i = 0; i < 32; i++)
            {
                BracketMatchup bm = new BracketMatchup();
                bm.X = x; bm.Y = y;
                Matchups.Add(bm);
                y += RectangleSize.Height + Padding;
                if (i == 15)
                {
                    x += 8 * (Padding + RectangleSize.Width);
                    y  = Padding;
                }
            }
            x = Padding + Padding + RectangleSize.Width;
            y = Padding + (Padding + RectangleSize.Height) / 2;
            for (i = 0; i < 16; i++)
            {
                BracketMatchup bm = new BracketMatchup();
                bm.X = x; bm.Y = y;
                Matchups.Add(bm);
                Matchups[2 * i].NextRound     = bm;
                Matchups[2 * i + 1].NextRound = bm;
                bm.PrevRound1 = Matchups[2 * i];
                bm.PrevRound2 = Matchups[2 * i + 1];
                y            += 2 * (RectangleSize.Height + Padding);
                if (i == 7)
                {
                    x += 6 * (Padding + RectangleSize.Width);
                    y  = Padding + (Padding + RectangleSize.Height) / 2;
                }
            }
            x = Padding + 2 * (Padding + RectangleSize.Width);
            y = Padding + 3 * (Padding + RectangleSize.Height) / 2;
            for (i = 0; i < 8; i++)
            {
                BracketMatchup bm = new BracketMatchup();
                bm.X = x; bm.Y = y;
                Matchups.Add(bm);
                Matchups[2 * i + 32].NextRound = bm;
                Matchups[2 * i + 33].NextRound = bm;
                bm.PrevRound1 = Matchups[2 * i + 32];
                bm.PrevRound2 = Matchups[2 * i + 33];
                y            += 4 * (RectangleSize.Height + Padding);
                if (i == 3)
                {
                    x += 4 * (Padding + RectangleSize.Width);
                    y  = Padding + 3 * (Padding + RectangleSize.Height) / 2;
                }
            }

            x = Padding + 3 * (Padding + RectangleSize.Width);
            y = Padding + 7 * (Padding + RectangleSize.Height) / 2;
            for (i = 0; i < 4; i++)
            {
                BracketMatchup bm = new BracketMatchup();
                bm.X = x; bm.Y = y;
                Matchups.Add(bm);
                Matchups[2 * i + 48].NextRound = bm;
                Matchups[2 * i + 49].NextRound = bm;
                bm.PrevRound1 = Matchups[2 * i + 48];
                bm.PrevRound2 = Matchups[2 * i + 49];

                y += 8 * (RectangleSize.Height + Padding);
                if (i == 1)
                {
                    x += 2 * (Padding + RectangleSize.Width);
                    y  = Padding + 7 * (Padding + RectangleSize.Height) / 2;
                }
            }
            x = Padding + 4 * (Padding + RectangleSize.Width);
            y = Padding + 7 * (Padding + RectangleSize.Height) / 2;
            for (i = 0; i < 2; i++)
            {
                BracketMatchup bm = new BracketMatchup();
                bm.X = x; bm.Y = y;
                Matchups.Add(bm);
                Matchups[2 * i + 56].NextRound = bm;
                Matchups[2 * i + 57].NextRound = bm;
                bm.PrevRound1 = Matchups[2 * i + 56];
                bm.PrevRound2 = Matchups[2 * i + 57];
                y            += 8 * (Padding + RectangleSize.Height);
            }
            y = 15 * (Padding + RectangleSize.Height) / 2;
            {
                BracketMatchup bm = new BracketMatchup();
                bm.X = x; bm.Y = y;
                Matchups.Add(bm);
                Matchups[60].NextRound = bm;
                Matchups[61].NextRound = bm;
                bm.PrevRound1          = Matchups[60];
                bm.PrevRound2          = Matchups[61];
            }
        }
Пример #23
0
    public float getModifier()
    {
        Type attackingPType = Attacker.GetCreature().getPType();
        Type attackingSType = Attacker.GetCreature().getSType();
        Type defendingPType = Defender.GetCreature().getPType();
        Type defendingSType = Defender.GetCreature().getSType();
        //Debug.Log(attackingPType);
        //Debug.Log(defendingPType);

        List <Type> strongMatchups = Matchups.getStrongTypeEffectiveness(this.Type);

        float weakTypeMultiplier = 1.0f; //default

        if (strongMatchups.Contains(defendingPType) && strongMatchups.Contains(defendingSType))
        {
            //if BOTH defending types are weak to attacking move type
            weakTypeMultiplier = 4.0f;
        }
        else if (strongMatchups.Contains(defendingPType) || strongMatchups.Contains(defendingSType))
        {
            //if ONE of the defending types is weak to the attacking move type
            weakTypeMultiplier = 2.0f;
        }

        List <Type> weakMatchups = Matchups.getWeakTypeEffectiveness(this.Type);

        float resistantTypeMultiplier = 1.0f; //default

        if (weakMatchups.Contains(defendingPType) && weakMatchups.Contains(defendingSType))
        {
            //if BOTH defending types are resistant to attacking move type
            resistantTypeMultiplier = 0.25f;
        }
        else if (weakMatchups.Contains(defendingPType) || weakMatchups.Contains(defendingSType))
        {
            //if ONE of the defending types is resistant to the attacking move type
            resistantTypeMultiplier = 0.5f;
        }

        float stabMultiplier = 1.0f; //default

        if (attackingPType == this.Type || attackingSType == this.Type)
        {
            //since moves only have 1 type only need to do an OR check
            stabMultiplier = 1.5f;
        }
        //dont need this

        /* else if (Matchups.getLinkedTypes(attackingType).Contains(this.Type)) {
         *  stabMultiplier = 1.5f;
         * } else if (Matchups.getUnlinkedTypes(attackingType).Contains(this.Type)) {
         *  stabMultiplier = 0.75f;
         * } */

        float critMultiplier = 1.0f;
        float random         = Random.Range(0, 1);

        if (this.CritChance > random)
        {
            critMultiplier = 2.0f;
        }
        Debug.Log("modifier values: " + resistantTypeMultiplier.ToString() + " " + weakTypeMultiplier.ToString() + " "
                  + stabMultiplier.ToString() + " " + critMultiplier.ToString());

        return(resistantTypeMultiplier * weakTypeMultiplier * stabMultiplier * critMultiplier);
    }
Пример #24
0
 private void FormMatch_Load(object sender, EventArgs e)
 {
     FormatDataGridMatchup();
     matchupList = Matchups.ReadData("", "");
     ShowDataGridMatchup();
 }
        public SwissBracket(BracketModel _model)
            : base(_model)
        {
            /*
             * This constructor extends the parent (round robin) version.
             * By the time we're "here," we already have our main data restored:
             * Players, Matches, and inherited Bracket fields.
             * Now, we need to recreate the Swiss-specific fields:
             * Matchups, PlayerByes, and PairingMethod.
             */

            for (int r = 1; r <= NumberOfRounds; ++r)
            {
                List <IMatch> round = GetRound(r);
                if (round.Any(m => m.Players.Contains(null)))
                {
                    // This round isn't populated yet. Break out:
                    break;
                }

                // playersInRound is a list of all players (by index)
                // in matchups this round. We check for the missing player
                // to know who got a bye.
                List <int> playersInRound = new List <int>();

                foreach (IMatch match in round)
                {
                    // For each populated Match, add a Matchup to the private list:
                    int defIndex  = Players.FindIndex(p => p.Id == match.Players[(int)PlayerSlot.Defender].Id);
                    int chalIndex = Players.FindIndex(p => p.Id == match.Players[(int)PlayerSlot.Challenger].Id);

                    playersInRound.Add(defIndex);
                    playersInRound.Add(chalIndex);
                    Matchups.Add(new Matchup(defIndex, chalIndex, r));
                }

                if (playersInRound.Count < Players.Count)
                {
                    // Find the player with a bye this round:
                    int byePlayerIndex = Enumerable
                                         .Range(0, Players.Count).ToList()
                                         .Except(playersInRound).First();

                    // Add him to Byes list and award a "Win" Outcome:
                    PlayerByes.Add(Players[byePlayerIndex].Id);
                    Rankings.Find(p => p.Id == Players[byePlayerIndex].Id)
                    .AddMatchOutcome(Outcome.Win, true);
                }

                // Set ActiveRound (this finds the last populated round):
                ActiveRound = r;
            }

            // Determine the Pairing Method from examining round 1:
            // (default is Slide)
            this.PairingMethod = PairingMethod.Slide;
            if (NumberOfMatches > 0 && ActiveRound > 0)
            {
#if CHOOSE_PAIRING
                // Find the top seed's first Match:
                int firstPlayerIndex = (0 == PlayerByes.Count)
                                        ? 0 : 1;
                IMatch firstPlayerMatch = GetRound(1)
                                          .Where(m => m.Players.Select(p => p.Id).Contains(this.Players[firstPlayerIndex].Id))
                                          .First();
                // Find the ID of the Player the top seed is matched against:
                int secondPlayerId = firstPlayerMatch.Players
                                     .Select(p => p.Id)
                                     .Where(i => i != this.Players[firstPlayerIndex].Id)
                                     .First();

                if (Players[1 + firstPlayerIndex].Id == secondPlayerId)
                {
                    // The second Player is also the second seed.
                    // This must be Adjancent pairings.
                    PairingMethod = PairingMethod.Adjacent;
                }
                else if (Players.Last().Id == secondPlayerId)
                {
                    // The second Player is the last seed.
                    // This must be Fold pairings.
                    PairingMethod = PairingMethod.Fold;
                }
#endif

                if (PlayerByes.Count > 0)
                {
                    // If we added points for byes, we need to update rankings.
                    // Call the parent (round robin) method:
                    UpdateRankings();
                }
            }
        }