public static Bots Load(Stream stream) { var collection = SimulationBotCollection.Load(stream); var bots = new Bots(); bots.AddRange(collection); return(bots); }
public void Run() { lock (lockList) { if (File.Exists) { Bots.AddRange(SimulationBotCollection.Load(File)); } if (Bots.Count < 2) { Bots.Clear(); Bots.Add(GetDef()); Bots.Add(GetDef()); BestBot = Bots.GetHighestElo(); } } var keepRunning = true; while (true) { LogRankings(); LogStatus(); if (!keepRunning) { break; } Bots.CloneBots(Randomizer); Bots.Shrink(); var pairings = Bots.GetPairings(Rnd); var copy = pairings.ToList(); if (InParallel) { keepRunning = SimulateParallel(copy); } else { keepRunning = Simulate(copy); } Bots.Process(Results); } }