private void RunTournament([NotNull] ArenaPlayer[] players, [NotNull] string tournamentId) { var tournamentPlayers = players.Select(p => new TournamentPlayer { Name = p.Name, Version = p.Version, Program = p.Program, }).ToArray(); var tournament = new RoundRobinTournament(battleRunner, battlesPerPair, tournamentId, tournamentPlayers, botSubmissionSignal, stopSignal); var result = tournament.Run(); arenaState.GamesRepo.SaveTournamentResult(tournamentId, result); }
public void DoubleChecked() { var players = TestWarriors.GetBotFiles("warriors-bad").Select(botFilename => new TournamentPlayer { Name = Path.GetFileNameWithoutExtension(botFilename), Program = File.ReadAllText(botFilename), Version = 1, }).ToArray(); var battleRunner = new DobleCheckedBattleRunner(); var tournament = new RoundRobinTournament(battleRunner, 1, "completeRanking", players, null, null, false); var result = tournament.Run(); var battlesWithDifferentResults = battleRunner.BattlesWithDifferentResults; File.WriteAllText(@"failed-battles.json", JsonConvert.SerializeObject(battlesWithDifferentResults, Formatting.Indented)); File.WriteAllText(@"complete-ranking.json", JsonConvert.SerializeObject(result.TournamentRanking, Formatting.Indented)); Assert.That(battlesWithDifferentResults.Count, Is.EqualTo(0)); }
public void UberTournament() { var players = TestWarriors.GetBotFiles("warriors-ok").Concat(TestWarriors.GetBotFiles("warriors-vec")).Select(botFilename => new TournamentPlayer { Name = Path.GetFileNameWithoutExtension(botFilename), Program = File.ReadAllText(botFilename), Version = 1, }) .ToArray(); Log.For(this).InfoFormat("Number of players: {0}", players.Length); var battleRunner = new BattleRunner(); var tournament = new RoundRobinTournament(battleRunner, 1, "allBotsRanking", players, null, null, false); var result = tournament.Run(); File.WriteAllText(@"all-bots-ranking.json", JsonConvert.SerializeObject(result.TournamentRanking, Formatting.Indented)); }