private void LogStatus() { Bots.Save(File); var sorted = Bots.ByElo().ToList(); using (var writer = new StreamWriter("parameters.cs", false)) { foreach (var bot in sorted) { writer.WriteLine("// Elo: {0:0}, {1}, ID: {2}, Parent: {3}, Gen: {4}", bot.Elo, bot.Stats, bot.Id, bot.ParentId, bot.Generation); writer.WriteLine(BotData.ParametersToString(bot.DefPars)); writer.WriteLine(); } } }
private void LogRankings() { var sorted = Bots.ByElo().ToList(); BestBot = Bots.GetHighestStableElo(); var parentId = BestBot == null ? -1 : BestBot.Id; Console.Clear(); var max = Math.Min(Console.WindowHeight - 2, Bots.Count); for (var pos = 1; pos <= max; pos++) { var bot = sorted[pos - 1]; if (bot == BestBot) { Console.ForegroundColor = ConsoleColor.Yellow; } else if (bot.IsStable) { Console.ForegroundColor = bot.ParentId == parentId ? ConsoleColor.Green : ConsoleColor.White; } else { Console.ForegroundColor = bot.ParentId == parentId ? ConsoleColor.DarkGreen : ConsoleColor.Gray; } Console.Write("{0,3}", pos); Console.Write(" {0:0000.0}", bot.Elo); Console.Write(", {0}", bot.Stats); Console.Write(", ID: {0,5}", bot.Id); Console.Write(bot.Locked ? '*' : ' '); Console.Write("(par: {0}, gen: {1})", bot.ParentId, bot.Generation); Console.WriteLine(); } Console.ForegroundColor = ConsoleColor.Gray; Console.WriteLine(); }