private bool VerbIsInList(PhrasalVerb possiblePhrasalVerb, List <string> verbMeaningOptions) { if (verbMeaningOptions.Any(verb => verb == possiblePhrasalVerb.VerbMeaning)) { return(true); } return(false); }
public void DisplayLevel() { askedPhrasalVerb = game.GetPhrasalVerb(); verbMeaningOptions = game.GetVerbMeaningOptions(); askedPhrasalVerbLabel.Text = askedPhrasalVerb.VerbName; for (int i = 0; i < verbMeaningOptionsButtons.Count; i++) { verbMeaningOptionsButtons[i].Text = verbMeaningOptions[i]; } punctuationLabel.Text = game.GetPunctuation(); }
private void PopulatePhrasalVerbList() { using (var reader = new StreamReader(@"Verbs/PhrasalVerbs.txt")) { while (!reader.EndOfStream) { PhrasalVerb phrasalVerb = new PhrasalVerb(); var line = reader.ReadLine(); var values = line.Split(';'); phrasalVerb.VerbName = values[0]; phrasalVerb.VerbMeaning = values[1]; PhrasalVerbs.Add(phrasalVerb); } } }
internal List <string> GetVerbMeaningOptions() { List <string> verbMeaningOptions = new List <string>(); verbMeaningOptions.Add(PhrasalVerbs[Level].VerbMeaning); for (int i = 0; i < NUMBER_OF_OPTIONS - 1; i++) { PhrasalVerb possiblePhrasalVerb = new PhrasalVerb(); do { possiblePhrasalVerb = PhrasalVerbs[random.Next(0, PhrasalVerbs.Count)]; } while (VerbIsInList(possiblePhrasalVerb, verbMeaningOptions)); verbMeaningOptions.Add(possiblePhrasalVerb.VerbMeaning); } verbMeaningOptions.Shuffle(); return(verbMeaningOptions); }