private void HandleEnvironmentRan(object sender, EnvironmentRanEventArgs e) { UpdateEnvironmentImage(); UpdateButtonsToEnvironmentStopped(); UpdateMovesText(e.Cycles); lsvBots.Enabled = true; UpdateMovesText(e.Cycles); var botsText = StringHelper.Join(e.Bots.Select(b => b.Name).ToList(), ", ", RunnerUserControlResource.AndText); AddOutputMessage(StringHelper.FormatSingularOrPlural(e.Bots.Count, RunnerUserControlResource.BotHasFinishedMessage, RunnerUserControlResource.BotsHaveFinishedMessage, botsText)); AddOutputMessage(RunnerUserControlResource.EnvironmentFinishedInCyclesMessage, e.Cycles); }
void Host_EnvironmentRan(object sender, EnvironmentRanEventArgs e) { var environment = e.Environment; var bots = e.Bots; // Save the bots ranking. var botsRanking = environment.GetBotsRanking(); if (botsRanking != null && botsRanking.Length > 0 && botsRanking.All(br => br != null)) { foreach (BotRank br in botsRanking) { //BotRankingPersister.SaveBotRanking(br.Bot.Name, environment.Name, br.Score); } } else { foreach (IBot b in bots) { //BotRankingPersister.SaveBotRanking(b.Name, environment.Name, 0); } } }