public void Done() { _finalized = true; _scores = new Dictionary <BotKind, int>(BotPairBuilder.GetAllBotKinds().ToDictionary(bk => bk, bk => 0)); foreach (var botPair in _matchResults) { switch (botPair.MatchResult) { case MatchResult.Draw: _scores[botPair.FirstPlayer] += DrawBonus; _scores[botPair.SecondPlayer] += DrawBonus; break; case MatchResult.FirstWon: _scores[botPair.FirstPlayer] += WinBonus; _scores[botPair.SecondPlayer] += LoseBonus; break; case MatchResult.SecondWon: _scores[botPair.FirstPlayer] += LoseBonus; _scores[botPair.SecondPlayer] += WinBonus; break; } } }
private static void Main() { Logger.Level = LogLevel.Debug; Logger.RegisterReceiver(new ColoredConsoleLogger()); Game.Mute(); var score = new GlobalScore(); foreach (var botPair in BotPairBuilder.GetAllBotPairs()) { var firstBotKind = botPair.FirstPlayer; var secondBotKind = botPair.SecondPlayer; var competitionConfiguration = new CompetitionConfiguration { BotTurnLength = BotTurnLength, FirstBotKind = firstBotKind, SecondBotKind = secondBotKind, Height = FieldHeight, Width = FieldWidth, RunCount = PairCompetitionCount }; var competitionRunner = CompetitionRunner.CreateRunner(competitionConfiguration); if (competitionRunner == null) { Logger.LogEntry("COMPETITION", LogLevel.Error, "Failed to create competition"); continue; } var competitionResult = competitionRunner.Run(); score.Add(botPair, competitionResult); Logger.LogEntry("COMPETITION", LogLevel.Info, competitionResult.ToString()); } score.Done(); score.Print(); }