AIsOfCatan.GameController.GameLoop C# (CSharp) Method

GameLoop() private method

Executes the game, each player turn by turn until a player wins
private GameLoop ( ) : int
return int
        private int GameLoop()
        {
            while (round < maxRounds)
            {
                if (turn == 0) round++;
                try
                {
                    TakeTurn(players[turn]);
                    if (debug) ShowScores();
                }
                finally { }
                /*catch (AgentActionException e)
                {
                    Console.WriteLine("Player " + players[turn].Id + ", caused an exception: " + e.GetType().Name);
                    Console.WriteLine("\t\t-> Message: " + e.Message);
                    //Console.WriteLine(e.StackTrace);
                    if (e.StopGame)
                    {
                        Console.WriteLine("This is game breaking, and the game ends now.");
                        return -1;
                    }
                }*/
                if (HasWon(players[turn])) return players[turn].Id;

                NextTurn();
            }
            return -1;
        }