Ejemplo n.º 1
0
        public List <TournamentEntrant> RunTournament(List <TournamentEntrant> entrants, int targetScore, bool debug = false)
        {
            int        winnerScore = 0;
            Game       game;
            GameResult result;

            while (winnerScore < targetScore)
            {
                game       = new Game(GetPlayers(entrants), generator.Next());
                game.debug = debug;
                result     = game.PlayGame();

                // Add up points for winner
                foreach (TournamentEntrant entrant in entrants)
                {
                    if (entrant.ToString() == result.winnerName)
                    {
                        entrant.score += result.pointsWon;
                        winnerScore    = entrant.score;
                        break;
                    }
                }
            }

            return(entrants);
        }