public void Level(String zeros, String randZeros, int substring, int tier, int nMax) { List <string> options = new List <string>(); String newCall; DeweyDecimalSystem newOption = callNumbers.Values.ElementAt(answer); options.Add(callNumbers.Keys.ElementAt(answer).Substring(tier, 1) + zeros + GetTierDescription(newOption, tier)); while (options.Count < matches) { string temp = callNumbers.Keys.ElementAt(answer).Substring(substring, 1) + randZeros; int min = int.Parse(temp); int max = min + nMax; newCall = randomGen.GetRandomNumber(min, max); newOption = randomGen.GenerateDescriptions(newCall.ToString()); temp = newCall.ToString().Substring(tier, 1) + zeros + GetTierDescription(newOption, tier); if (!options.Contains(temp) && GetTierDescription(newOption, tier) != "") { options.Add(temp); } } optionsListView.ItemsSource = options.OrderBy(a => Guid.NewGuid()).ToList(); }
public void CheckScore() { SecondList.ItemContainerStyle = null; SecondList.ItemsSource = null; correct = 0; switch (ListToggle.IsChecked) { case false: for (int i = 0; i < matches; i++) { if (values[i] == callNumbers.Values.ElementAt(i).High) { SecondList.Items.Add(new ListBoxItem { Content = callNumbers.Values.ElementAt(i).High, Background = Brushes.DarkGreen }); correct++; } else { SecondList.Items.Add(new ListBoxItem { Content = callNumbers.Values.ElementAt(i).High, Background = Brushes.DarkRed }); } } break; case true: List <String> temp = new List <String>(); foreach (String item in keys) { temp.Add(randomGen.GenerateDescriptions(item).High); } for (int i = 0; i < matches; i++) { if (temp[i] == callNumbers.Values.ElementAt(i).High) { SecondList.Items.Add(new ListBoxItem { Content = callNumbers.Keys.ElementAt(i), Background = Brushes.DarkGreen }); correct++; } else { SecondList.Items.Add(new ListBoxItem { Content = callNumbers.Keys.ElementAt(i), Background = Brushes.DarkRed }); } } break; } historyPanel.Children.Insert(0, elementFunctions.GetScoreCard($"{correct}/{matches}. {score.getScoreStatement(correct, matches)}", scores.Count, (Style)FindResource("MaterialDesignBody2TextBlock"))); Double tempScore = (Double)correct / (Double)matches; tempScore *= 100; scores.Add((int)tempScore); averageScore.Text = $"{(int)scores.Average()}%"; testsTaken.Text = scores.Count().ToString(); checkOrder.Visibility = Visibility.Collapsed; reset.Visibility = Visibility.Visible; }