예제 #1
0
 public bool BeginQuiz()
 {
     if (quizState != QUIZ_STATE.INIT)
     {
         return(false);
     }
     quizState = QUIZ_STATE.ANSWERED;
     return(true);
 }
예제 #2
0
 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;
 }
예제 #3
0
 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);
 }
예제 #4
0
        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);
        }