Exemple #1
0
        private void SetThisRoundDoubles(List <PlayerTeam> tlist)
        {
            var matchlist = MatchOrganizer.DoublesMatchList(tlist);

            if (matchlist[0].Team1.Player1.PlayerGender == Player.Gender.Male || matchlist[0].Team1.Player2.PlayerGender == Player.Gender.Female)
            {
                MatchOrganizer.AddRef(matchlist, MaleRefs);
            }
            else
            {
                MatchOrganizer.AddRef(matchlist, FemaleRefs);
            }

            ThisRound = matchlist;
            PlayRound();
        }
Exemple #2
0
        private void SetThisRoundSingles(List <Player> plist)
        {
            var matchlist = MatchOrganizer.SinglesMatchList(plist);

            if (matchlist[0].Player1.PlayerGender == Player.Gender.Male)
            {
                MatchOrganizer.AddRef(matchlist, MaleRefs);
            }
            else
            {
                MatchOrganizer.AddRef(matchlist, FemaleRefs);
            }

            ThisRound = matchlist;
            PlayRound();
        }
Exemple #3
0
        private void PlayRound()
        {
            NoRounds += 1;
            if (ThisRound.Count == 1)
            {
                Console.WriteLine("Welcome to the final!");
            }
            else
            {
                Console.WriteLine("Welcome to round number " + NoRounds + "!");
            }
            Random rand = new Random();

            foreach (Match p in ThisRound)
            {
                p.PlayMatch(rand);
            }
            if (ThisRound.Count > 1)
            {
                var nextround = MatchOrganizer.NextRound(ThisRound);
                ThisRound = nextround;
                Console.WriteLine("");
                Console.WriteLine("Press any key to start next round:");
                Console.ReadKey();

                PlayRound();
            }
            else
            {
                if (ThisRound[0].WinnerSingle == null)
                {
                    Console.WriteLine(ThisRound[0].WinnerDouble.Player1.FirstName + " " +
                                      ThisRound[0].WinnerDouble.Player1.LastName + " and " +
                                      ThisRound[0].WinnerDouble.Player2.FirstName + " " +
                                      ThisRound[0].WinnerDouble.Player2.LastName + " wins the tournament!");
                }
                else
                {
                    Console.WriteLine(ThisRound[0].WinnerSingle.FirstName + " " + ThisRound[0].WinnerSingle.LastName + " wins the tournament!");
                }
            }
        }