private bool InitNewLearningTask() { //m_currentLearningTask = Curriculum.GetNextLearningTask(); // end of curriculum - there are no more LTs if (CurrentLearningTask == null) { return(false); } // inform user about new LT MyLog.Writer.WriteLine(MyLogLevel.INFO, "Switching to LearningTask: " + CurrentLearningTask.GetTypeName()); CurrentLearningTask.Init(); if (ControlModeHidden == ControlMapper.ControlMode.SimpleTaskSpecific) { ControlMapper.ControlsID = m_currentTaskId = taskIdMap[CurrentLearningTask.GetType()]; } NotifyNewTrainingUnit(); NotifyNewLevel(); return(true); }
private void ExecuteLearningTaskStep() { ResetLTStatusFlags(); Reward = 0.0f; // resets reward signal if (ShowBlackscreen && m_drawBlackscreen) { // Skip task evaluation, a black screen will show up this step MoveLTStatusToDevice(); return; } if (!CurrentLearningTask.IsInitialized) { InitNewLearningTask(); } else { // evaluate previus step CurrentLearningTask.ExecuteStep(); // set new level, training unit or step // this also partially sets LTStatus TaskResult = CurrentLearningTask.EvaluateStep(); switch (TaskResult) { case TrainingResult.TUInProgress: TrainingUnitUpdated(this, new SchoolEventArgs(CurrentLearningTask)); break; case TrainingResult.FinishedTU: NotifyNewTrainingUnit(); break; case TrainingResult.FailedLT: if (Owner.SimulationHandler.CanPause) { Owner.SimulationHandler.PauseSimulation(); } return; case TrainingResult.FinishedLevel: CurrentLearningTask.IncreaseLevel(); if (CurrentLearningTask.CurrentLevel >= CurrentLearningTask.NumberOfLevels) { TaskResult = TrainingResult.FinishedLT; NotifyNewLearningTask(); } else { NotifyNewLevel(); } break; default: throw new ArgumentOutOfRangeException(); } } // set new learning task if (m_schoolStatus.m_isNewLT) { m_shouldShowNewLearningTask = true; } // if new TU is requested, present new training unit else if (m_schoolStatus.m_isNewTU) { CurrentLearningTask.PresentNewTrainingUnitCommon(); } MoveLTStatusToDevice(); }