private void predictButton_Click(object sender, EventArgs e) { //validate teams if (ranker.HasRanking(redTeam1.Text) && ranker.HasRanking(redTeam2.Text) && ranker.HasRanking(blueTeam1.Text) && ranker.HasRanking(blueTeam2.Text)) { Tuple <double, double> winChances = ranker.CalcWinChances(new Alliance(redTeam1.Text, redTeam2.Text), new Alliance(blueTeam1.Text, blueTeam2.Text)); redWinChance.Text = winChances.Item1.ToString("F2") + "%"; blueWinChance.Text = winChances.Item2.ToString("F2") + "%"; } else { MessageBox.Show("Please enter valid team names."); } }
static void Main(string[] args) { double brierScore = 0; Console.Write("Enter SKU: "); string sku = Console.ReadLine(); VexDbApi vexDbApi = new VexDbApi(); Ranker ranker = new Ranker(); IList <Match> matches = vexDbApi.GetMatchesBySku(sku); foreach (var match in matches) { ranker.RankMatch(match); var winChance = ranker.CalcWinChances(match.AllianceRed, match.AllianceBlue); //calculate brier score int actual = match.ScoreRed > match.ScoreBlue ? 1 : 0; brierScore += Math.Pow((winChance.Item1 / 100) - actual, 2); } brierScore /= matches.Count; Console.WriteLine("Brier score is: {0}", brierScore); Console.ReadKey(true); }