Esempio n. 1
0
        private ITeacherState CheckResult(AfterFrameHandleEventArgs afterFrameHandleEventArgs)
        {
            if (State.Score > 10)
            {
                return(new Passed(State));
            }

            var outputClass  = afterFrameHandleEventArgs.OutputClass.ToString();
            var stateDetails = new Model.AppModel.TeacherState()
            {
                CurrentLetter = State.CurrentLetter,
                LettersToKnow = State.LettersToKnow,
                Message       = State.Message,
                Score         = State.Score
            };

            if (stateDetails.CurrentLetter.Equals(outputClass))
            {
                stateDetails.Score++;
                stateDetails.Message = "Cool! It's correct sign";
            }
            else
            {
                stateDetails.Score   = 0;
                stateDetails.Message = "Wrong. Try again!";
            }

            return(new Active(stateDetails));
        }
Esempio n. 2
0
        public ITeacherState HandleDecision(AfterFrameHandleEventArgs afterFrameHandleEventArgs)
        {
            var outputClasses = Enum.GetValues(typeof(OutputClass));
            var currentLetter = GetCurrentLetter(outputClasses);
            var lettersToKnow = GetLettersToKnow(outputClasses);

            var stateDetails = new Model.AppModel.TeacherState()
            {
                CurrentLetter = currentLetter,
                LettersToKnow = lettersToKnow,
                Score         = 0
            };

            return(new Active(stateDetails));
        }
Esempio n. 3
0
 public Passed(Model.AppModel.TeacherState state)
 {
     State = state;
 }
Esempio n. 4
0
 public Active(Model.AppModel.TeacherState state)
 {
     State = state;
 }
Esempio n. 5
0
 public Uninitialized(Model.AppModel.TeacherState teacherState)
 {
     State = teacherState;
 }