public static void Main(string[] args) { Helper.INIT(); try { GameLayer.EndGame(); } catch (Exception e) { } var gameId = GameLayer.NewGame(Map); Console.WriteLine($"Starting game: {GameLayer.GetState().GameId}"); GameLayer.StartGame(gameId); var state = GameLayer.GetState(); while (GameLayer.GetState().Turn < GameLayer.GetState().MaxTurns) { //Console.WriteLine(GameLayer.GetState().CurrentTemp); NewTakeTurn(); //take_turn(gameId); foreach (var message in GameLayer.GetState().Messages) { Console.WriteLine(message); } foreach (var error in GameLayer.GetState().Errors) { Console.WriteLine("Error: " + error); } } Console.WriteLine($"Done with game: {GameLayer.GetState().GameId}"); Console.WriteLine(GameLayer.GetScore(gameId).FinalScore); }
static string RunOneGame(AI_nr2 AI) { var gameId = GameLayer.NewGame(Map); Log.Information($"Starting game: {GameLayer.GetState().GameId}"); GameLayer.StartGame(gameId); AI.ConfigureMap(); while (GameLayer.GetState().Turn < GameLayer.GetState().MaxTurns) { AI.Take_turn(gameId); } string endgame = string.Format("Money: {0} \nPop: {1} \nHappiness: {2} \nCo2: {3} \n\nFinal Pop Score: {4}, \nFinal Happiness Score: {5} \nFinal Co2 Score: {6} \nFinal Score: {7} \nDone with game {8}", GameLayer.GetState().Funds, GameLayer.GetScore(gameId).FinalPopulation, GameLayer.GetScore(gameId).TotalHappiness, GameLayer.GetScore(gameId).TotalCo2, GameLayer.GetScore(gameId).FinalPopulation * 15, GameLayer.GetScore(gameId).TotalHappiness / 10, GameLayer.GetScore(gameId).TotalCo2, GameLayer.GetScore(gameId).FinalScore.ToString(), GameLayer.GetState().GameId); return(endgame); }