public override CompetitorRanks GenerateResult(MatchStrategy matchStrategy, List<Competitor> competitors) { List<Match> matches = new List<Match>(); if (competitors.Count % 2 != 0) throw new ArgumentException("Collection count must be even.", "competitors"); // generate the results for the competitors // note that the competitors are paired in this round by the order they're in in the List object // pairing first with last, second with second-to-last, etc. for (int index = 0; index < competitors.Count / 2; index++) { int mirrorIndex = competitors.Count - (index + 1); Competitor competitorA = competitors[index]; Competitor competitorB = competitors[mirrorIndex]; Match match = new Match(matchStrategy, WinsToClinchMatch); match.Run(competitorA, competitorB); matches.Add(match); } Matches = matches; CompetitorPoints tournamentRoundPoints = AccumulateMatchPoints(matches); return tournamentRoundPoints.GetCompetitorRanks(); }
public override CompetitorRanks GenerateResult(int tournamentRunSequence, MatchStrategy matchStrategy, List<Competitor> competitors) { TournamentRoundStrategy tournamentRoundStrategy = new KoSfFiTRS(_winsToClinchMatch); TournamentRound tournamentRound = new TournamentRound(tournamentRoundStrategy, matchStrategy); return tournamentRound.Run(competitors); }
private void DisplayTestResults(TournamentStrategy tournamentStrategy, MatchStrategy matchStrategy, Study study) { Trace.WriteLine(string.Format("Number of Tournament Iterations: {0}", _numberOfTournamentIterations)); Trace.WriteLine(study.StrategyInformation); }
public override CompetitorRanks GenerateResult(int tournamentRunSequence, MatchStrategy matchStrategy, List<Competitor> competitors) { TournamentRound tournamentRound = new TournamentRound(new RrTRS(_numberOfRounds, _winsToClinchMatch), matchStrategy); return tournamentRound.Run(competitors); }
public abstract CompetitorRanks GenerateResult(MatchStrategy matchStrategy, List<Competitor> competitors);
public Study(TournamentStrategy tournamentStrategy, MatchStrategy matchStrategy, bool isLowMemoryMode) { _matchStrategy = matchStrategy; _thisTournamentStrategy = tournamentStrategy; _isLowMemoryMode = isLowMemoryMode; if (!_isLowMemoryMode) _tournaments = new List<Tournament>(); _tournamentMADs = new List<double>(); _tournamentMAD_Adjusteds = new List<double>(); _tournamentMAD_Adjusted_WithOddCompetitorAdjustments = new List<double>(); }
private void RunStudy(List<Competitor> competitors, TournamentStrategy tournamentStrategy, MatchStrategy matchStrategy, bool isJumbleCompetitorSeeds) { _currentIteration = 0; _startTime = DateTime.Now; Study study = new Study(tournamentStrategy, matchStrategy, chkIsLowMemoryMode.Checked); study.Iterated += new IteratedEventHandler(StudyIterated); if (!string.IsNullOrEmpty(txtResults.Text.Trim())) AppendResultsText("\r\n\r\n"); AppendResultsText("==============================================================================================="); try { study.Run(competitors, _numberOfTournamentIterations, isJumbleCompetitorSeeds); AppendResultsText(study.StrategyInformation); if (chkShowStudyStatistics.Checked) AppendResultsText(study.ResultsStatistics); if (chkShowStudyTransformationMatrix.Checked) AppendResultsText(study.CombinedTournamentTransformationMatrixForDisplay.ToString()); if (chkShowCompetitorInfo.Checked) AppendResultsText(study.CompetitorInformation); if (chkShowResultsFrequenciesGraph.Checked) AppendResultsText(study.ResultsFrequenciesGraph); if (chkShowRawTournamentResults.Checked) AppendResultsText(study.RawTournamentResultsForDisplay); if (chkShowRunTime.Checked) AppendResultsText(string.Format("\r\n\r\nRun Time: {0}", DateTime.Now.Subtract(_startTime))); } catch (Exception ex) { AppendResultsText(string.Format("\r\n\r\nTournament Strategy: {0}", study.TournamentStrategyForDisplay)); AppendResultsText(string.Format("\r\n\r\nCould not run this study. Error: {0}", ex.Message)); } finally { study = null; } }
public abstract CompetitorRanks GenerateResult(int tournamentRunSequence, MatchStrategy matchStrategy, List<Competitor> competitors);
private void RunStudy(List<Competitor> competitors, TournamentStrategy tournamentStrategy, MatchStrategy matchStrategy) { RunStudy(competitors, tournamentStrategy, matchStrategy, false); }
public Match(MatchStrategy matchStrategy, int winsToClinchMatch) { this.matchStrategy = matchStrategy; this.winsToClinchMatch = winsToClinchMatch; }
private static void DisplayTestResults(TournamentStrategy tournamentStrategy, MatchStrategy matchStrategy, Study study) { Trace.WriteLine("Study Parameters:"); Trace.WriteLine(string.Format("Tournament Strategy: {0}", tournamentStrategy.GetType())); Trace.WriteLine(string.Format("Match Strategy: {0}", matchStrategy.GetType())); Trace.WriteLine(string.Format("Number of Tournament Iterations: {0}", _numberOfTournamentIterations)); Trace.WriteLine(""); Trace.WriteLine(study.StrategyInformation); }
public Tournament(TournamentStrategy tournamentStrategy, MatchStrategy matchStrategy) { _matchStrategy = matchStrategy; _tournamentStrategy = tournamentStrategy; }
public TournamentRound(TournamentRoundStrategy tournamentRoundStrategy, MatchStrategy matchStrategy) { _matchStrategy = matchStrategy; _tournamentRoundStrategy = tournamentRoundStrategy; }