public void AddMatch(string playerOne, string playerTwo, bool firstPlayerWin)
        {
            var match = new TournamentBracketLogRoundMatch(playerOne, playerTwo, firstPlayerWin);

            Matches.Add(match);
        }
예제 #2
0
        /// <summary>
        /// Hier spielt der Gewinner vom Winning Bracket (winner) gegen den Gewinner vom Loserbracket (loser)
        /// Der Gewinner hat dabei zwei Versuche, wenn er beim ersten mal verliert hat er noch eine Chance da man nur bei zwei Niederlagen rausfliegt
        /// </summary>
        /// <param name="winner"></param>
        /// <param name="loser"></param>
        private void PlayFinale(Player winner, Player loser)
        {
            Console.WriteLine(ShowFinale());
            Console.WriteLine("Who is the Winner?");
            Console.WriteLine(winner.ToString() + " Or " + loser.ToString());
            bool correctPlayerInput = false;

            while (!correctPlayerInput)
            {
                string whoWonInput = Console.ReadLine();
                if (whoWonInput == winner.PlayerName.Title || whoWonInput == winner.PlayerID.ToString())
                {
                    Console.WriteLine("You Choose: " + winner.ToString());
                    Console.WriteLine("Winner of the Tournament: " + winner.ToString());
                    log.AddEntry("Winner: " + winner.ToString());
                    var match = new TournamentBracketLogRoundMatch(winner.ToString(), loser.ToString(), whoWonInput == winner.PlayerName.Title || whoWonInput == winner.PlayerID.ToString());
                    TournamentDoubleKoLog.FinalMatches.Add(match);
                    break;
                }
                else if (whoWonInput == loser.PlayerName.Title || whoWonInput == loser.PlayerID.ToString())
                {
                    var match = new TournamentBracketLogRoundMatch(winner.ToString(), loser.ToString(), whoWonInput == winner.PlayerName.Title || whoWonInput == winner.PlayerID.ToString());
                    TournamentDoubleKoLog.FinalMatches.Add(match);
                    Console.WriteLine("You Choose: " + loser.ToString());
                    Console.WriteLine("Second Chance!");
                    Console.WriteLine("Who is the Winner?");
                    Console.WriteLine(winner.ToString() + " Or " + loser.ToString());
                    while (!correctPlayerInput)
                    {
                        string WhoWonTournament = Console.ReadLine();
                        if (WhoWonTournament == winner.PlayerName.Title || WhoWonTournament == winner.PlayerID.ToString())
                        {
                            Console.WriteLine("You Choose: " + winner.ToString());
                            Console.WriteLine("Winner of the Tournament: " + winner.ToString());
                            log.AddEntry("Winner: " + winner.ToString());
                            correctPlayerInput = true;
                        }
                        else if (WhoWonTournament == loser.PlayerName.Title || WhoWonTournament == loser.PlayerID.ToString())
                        {
                            Console.WriteLine("You Choose: " + loser.ToString());
                            Console.WriteLine("Winner of the Tournament: " + loser.ToString());
                            log.AddEntry("Winner: " + loser.ToString());
                            correctPlayerInput = true;
                        }
                        if (correctPlayerInput)
                        {
                            var secondFinal = new TournamentBracketLogRoundMatch(winner.ToString(), loser.ToString(), WhoWonTournament == winner.PlayerName.Title || WhoWonTournament == winner.PlayerID.ToString());
                            TournamentDoubleKoLog.FinalMatches.Add(secondFinal);
                        }
                        else
                        {
                            Console.WriteLine("Wrong Input! Try Again.");
                        }
                    }
                }
                else
                {
                    Console.WriteLine("Wrong Input! Try Again.");
                }
                Console.WriteLine();
            }
        }