public bool BeginQuiz() { if (quizState != QUIZ_STATE.INIT) { return(false); } quizState = QUIZ_STATE.ANSWERED; return(true); }
public Quiz(SymptomsHolder symptomsHolder) { quizState = QUIZ_STATE.INIT; questions = new List <Question>(); answers = new List <Answer>(); askedQuestions = new HashSet <int>(); currentQuestionNumber = 0; this.symptomsHolder = symptomsHolder; }
public bool ProcessAnswer(Answer answer) { if (quizState != QUIZ_STATE.ANSWERING || answer.GetAnswerType() != currentQuestionType) { return(false); } symptomsHolder.ProcessAnswer(answer); answers.Add(answer); currentQuestionNumber++; quizState = QUIZ_STATE.ANSWERED; return(true); }
public Question GetNextQuestion() { if (quizState != QUIZ_STATE.ANSWERED) { return(null); } if (askedQuestions.Count >= maxQuestionCount || symptomsHolder.GetSignaturesCount() <= finalSignatureCount) { quizState = QUIZ_STATE.FINISHED; return(null); } quizState = QUIZ_STATE.ANSWERING; Question nextQuestion = symptomsHolder.GetNextQuestion(); currentQuestionType = nextQuestion.GetQuestionType(); currentSymptomType = nextQuestion.GetCorrespondingSymptom(); return(nextQuestion); }