private void RandomAskStudentQuestion() { TablePositionHelper.RandomStudentForAsking(); string rdmStd = TablePositionHelper.LatestChosenStudent; BaseHelper.Go(TablePositionHelper.FindTablePosByStdId(rdmStd)); Synthesizer.Speak(rdmStd + ". " + "Can you stand up?"); Wait(3000); int rdmIndex = new Random().Next(3); string speech = ""; switch (rdmIndex) { case 0: speech = "I have a question for you. Are you ready?"; break; case 1: speech = "I am going to ask you a question. Please think carefully " + "and give me the answer. "; break; case 2: speech = "Ok. I want to challenge you by asking a question. " + "Please listen carefully and answer. "; break; } Synthesizer.Speak(speech); Wait(3000); }
public void AskRandomStudent(List <StudentHistoryDTO> list) { var rdm = new Random(); int rdmNum = rdm.Next(1, 11); if (GlobalFlowControl.Lesson.ChosenStudent != null || rdmNum <= 8) { //ask Debug.WriteLine("ASKING STUDENT"); StudentHistoryDTO student; if (GlobalFlowControl.Lesson.ChosenStudent != null) { student = list.FirstOrDefault(x => x.Student_id == GlobalFlowControl.Lesson.ChosenStudent); if (GlobalFlowControl.Lesson.IsStudentChosenBefore(student.Student_id) == false) { GlobalFlowControl.Lesson.ChosenStudentList.Add(student.Student_id); } } else { int randNum; // All students have their all turns to be asked (approached) by robot if (GlobalFlowControl.Lesson.ChosenStudentList.Count == list.Count) { GlobalFlowControl.Lesson.ChosenStudentList.Clear(); } do { randNum = rdm.Next(0, list.Count); Debug.WriteLine("Random Student: " + randNum); } while (GlobalFlowControl.Lesson.IsStudentChosenBefore(list[randNum].Student_id)); student = list[randNum]; GlobalFlowControl.Lesson.ChosenStudentList.Add(student.Student_id); } string speech = student.UserAccountFullName + "! "; int num = rdm.Next(0, 5); switch (num) { case 0: speech += "Can you share what is your answer?"; break; case 1: speech += "Did you have your own answer? Is this question easy or difficult?"; break; case 2: speech += "What did you choose as your answer for this question?"; break; case 3: speech += "What do you think about this question?"; break; case 4: speech += "Can you share your answer to the class and explain why did you choose it?"; break; } //Get position of student var position = TablePositionHelper.FindTablePosByStdId(student.Student_id); if (position != null) { GlobalFlowControl.Lesson.ApproachStudent = position; //Go to student LessonHelper.InsertCommand("gountil", position); LessonHelper.InsertCommand("speak", speech); LessonHelper.InsertCommand("asking", "1"); bool studentResult = student.ResultInBinaryString.Last() == '1'; string resultSpeech = ""; if (studentResult) { switch (num) { case 0: case 1: resultSpeech = "Excellent "; break; case 2: case 3: resultSpeech = "Not bad "; break; case 4: resultSpeech = "Very good "; break; } resultSpeech += student.Student_id + "! Your answer is correct!"; } else { resultSpeech = "Sorry " + student.Student_id + ". Your answer is not correct!"; } LessonHelper.InsertCommand("speak", resultSpeech); } } AnalyzeStudentPerformance(AssessPerformance); }