public static IEnumerable <IQuestion> GetAllPossibleQuestions(IReadOnlyList <IQuestion> questions) { return (from addressedTo in PositionHelpers.AllPositions() from question in questions from answer in WordHelpers.AllWords() select new IsAnswerQuestion(addressedTo, question, answer)); }
private static IDictionary <Word, IList <ProblemMapping> > GetQuestionResults(IQuestion question, IEnumerable <ProblemMapping> problemMappings = null) { problemMappings = problemMappings ?? ProblemMapping.AllProblemMappings; var wordToMapping = WordHelpers.AllWords() .ToDictionary <Word, Word, IList <ProblemMapping> >(word => word, word => new List <ProblemMapping>()); foreach (var problemMapping in problemMappings) { var answers = question.GetPossibleAnswers(problemMapping).OrderBy(a => a); foreach (var answer in answers) { wordToMapping[problemMapping.AnswerMapping[answer]].Add(problemMapping); } } return(wordToMapping); }