private static void RunManyGames(GameOptions options) { NullIO io = new NullIO(options.Seed); var cx = 0; for (int i = 0; i < options.TestCount; i++) { int s = 0; if (options.Random) { s = new Random().Next(); Console.WriteLine("S" + s); } else { s = options.Seed + cx; cx += options.SeedInc; } RunOneGame(s, options.LevelCount, options.PlayerController, io); } Console.WriteLine($"Games: {io.GameComleted}/{options.TestCount} = {100*io.GameComleted/options.TestCount}"); Console.WriteLine($"LevelIndex completed: {io.LevelsCompleted}/{options.TestCount*options.LevelCount} = {100*io.LevelsCompleted/(options.TestCount * options.LevelCount)}"); Console.WriteLine($"{io.Wasted.TotalSeconds} s, {io.Wasted.TotalSeconds / io.GameComleted / options.LevelCount} s/l, {io.Wasted.TotalSeconds / io.GameComleted} s/g"); File.AppendText("res.txt").WriteLine($"Games: {io.GameComleted}/{options.TestCount} = {100 * io.GameComleted / options.TestCount}\n" + $"LevelIndex completed: {io.LevelsCompleted}/{options.TestCount * options.LevelCount} = {100 * io.LevelsCompleted / (options.TestCount * options.LevelCount)}"); if (options.WaitKey) { Console.ReadKey(); } }
private static void RunOneGame(int seed, int count, string pc, NullIO io) { var levels = GenerateLevels(seed, count); var playerController = BotLoader.LoadPlayerController(pc); var engine = new Engine("~", playerController, levels.First(), io, io); engine.GameLoop(); }