public SampleQuestionWithWordsProvider() { currentQuestion = -1; for (int i = 0; i < 32; i++) { List <ILivingLetterData> correctAnswers = new List <ILivingLetterData>(); List <ILivingLetterData> wrongAnswers = new List <ILivingLetterData>(); LL_WordData newWordData = AppManager.I.Teacher.GetRandomTestWordDataLL(); if (newWordData == null) { return; } correctAnswers.Add(newWordData); // At least 4 wrong words while (wrongAnswers.Count < 4) { var word = AppManager.I.Teacher.GetRandomTestWordDataLL(); if (!correctAnswers.Contains(word) && !wrongAnswers.Contains(word)) { wrongAnswers.Add(word); } } var currentPack = new SampleQuestionPack(newWordData, wrongAnswers, correctAnswers); questions.Add(currentPack); } }
public SampleQuestionProvider() { currentQuestion = -1; // 10 QuestionPacks for (int i = 0; i < 32; i++) { var correctAnswers = new List <ILivingLetterData>(); var wrongAnswers = new List <ILivingLetterData>(); var newWordData = AppManager.I.Teacher.GetRandomTestWordDataLL(); //LL_WordData newWordData = AppManager.I.Teacher.GetRandomTestWordDataLL(new WordFilters(requireDiacritics: true)); //LL_WordData newWordData = new LL_WordData(AppManager.I.DB.GetWordDataById("wolf")); if (newWordData == null) { return; } foreach (var letterData in ArabicAlphabetHelper.SplitWord(AppManager.I.DB, newWordData.Data)) { correctAnswers.Add(new LL_LetterData(letterData.letter)); } correctAnswers = correctAnswers.Distinct().ToList(); // At least 4 wrong letters while (wrongAnswers.Count < 4) { var letter = AppManager.I.Teacher.GetRandomTestLetterLL(); if (!CheckIfContains(correctAnswers, letter) && !CheckIfContains(wrongAnswers, letter)) { wrongAnswers.Add(letter); } } var currentPack = new SampleQuestionPack(newWordData, wrongAnswers, correctAnswers); questions.Add(currentPack); } }