private void SetBoxes(Bracket bracket)
        {
            List <BracketGame> r1 = bracket.GetRound(1);

            Round1Box1.Text = $"{r1[0].p1.name} ({r1[0].p1.games[0]})";
            Round1Box2.Text = $"{r1[0].p2.name} ({r1[0].p2.games[0]})";
            Round1Box3.Text = $"{r1[1].p1.name} ({r1[1].p1.games[0]})";
            Round1Box4.Text = $"{r1[1].p2.name} ({r1[1].p2.games[0]})";
            Round1Box5.Text = $"{r1[2].p1.name} ({r1[2].p1.games[0]})";
            Round1Box6.Text = $"{r1[2].p2.name} ({r1[2].p2.games[0]})";
            Round1Box7.Text = $"{r1[3].p1.name} ({r1[3].p1.games[0]})";
            Round1Box8.Text = $"{r1[3].p2.name} ({r1[3].p2.games[0]})";

            List <BracketGame> r2 = bracket.GetRound(2);

            Round2Box1.Text = $"{r2[0].p1.name} ({r2[0].p1.games[1]})";
            Round2Box2.Text = $"{r2[0].p2.name} ({r2[0].p2.games[1]})";
            Round2Box3.Text = $"{r2[1].p1.name} ({r2[1].p1.games[1]})";
            Round2Box4.Text = $"{r2[1].p2.name} ({r2[1].p2.games[1]})";


            BracketGame r3 = bracket.GetRound(3)[0];

            Round3Box1.Text = $"{r3.p1.name} ({r3.p1.games[2]})";
            Round3Box2.Text = $"{r3.p2.name} ({r3.p2.games[2]})";



            FirstPlace.Text  = $"{r3.GetWinner(3).name} - $25";
            SecondPlace.Text = $"{r3.GetLoser(3).name} - $10";
        }
Exemple #2
0
 public override bool Equals(object obj)
 {
     if ((obj == null) || !this.GetType().Equals(obj.GetType()))
     {
         return(false);
     }
     else
     {
         BracketGame g = (BracketGame)obj;
         return((p1 == g.p1) && (p2 == g.p2) || (p1 == g.p2) && (p2 == g.p1));
     }
 }
        /// <summary>
        /// places the seeded players into brackets. if it gets stuck, returns false.
        /// </summary>
        /// <param name="game"></param>
        /// <returns></returns>
        private bool TryAddGame(BracketGame game)
        {
            foreach (Bracket bracket in Brackets)
            {
                if (bracket.IsEligible(game) && !bracket.IsFull())
                {
                    bracket.AddGame(game);
                    return(true);
                }
            }


            return(false);
        }
        public List <BracketGame> Shuffle(List <BracketGame> game)

        {
            int n = game.Count;

            while (n > 1)

            {
                n--;

                int k = rng.Next(n + 1);

                BracketGame value = game[k];

                game[k] = game[n];

                game[n] = value;
            }
            return(game);
        }
Exemple #5
0
 public void AddGame(BracketGame game)
 {
     Games.Add(game);
     Players.Add(game.p1);
     Players.Add(game.p2);
 }
Exemple #6
0
 public bool IsEligible(BracketGame bracket)
 {
     return(!(Players.Contains(bracket.p1) || Players.Contains(bracket.p2)));
 }
Exemple #7
0
 public bool IsSeeded(BracketGame bracket)
 {
     return(Games.Contains(bracket));
 }