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));
     }
 }
Beispiel #2
0
        /// <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);
        }
Beispiel #3
0
        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);
        }
Beispiel #4
0
 public void AddGame(BracketGame game)
 {
     Games.Add(game);
     Players.Add(game.p1);
     Players.Add(game.p2);
 }
Beispiel #5
0
 public bool IsEligible(BracketGame bracket)
 {
     return(!(Players.Contains(bracket.p1) || Players.Contains(bracket.p2)));
 }
Beispiel #6
0
 public bool IsSeeded(BracketGame bracket)
 {
     return(Games.Contains(bracket));
 }