def check_response(self, event):
     # check if the answer matches any of the possible ways of expressing
     # the correct number.
     if any(
             event.is_message(correct_alt, '.')
             for correct_alt in msg.number_to_strings(self.object_count)):
         self.set_reward(1, random.choice(msg.congratulations))
 def check_response(self, event):
     # check if the answer matches any of the possible ways of expressing
     # the correct number.
     # NB: note that here a longer digit string ending with the currect
     # number will be considered correct (e.g., 321 when the correct answer
     # is 1)
     if any(event.is_message(correct_alt, '.')
            for correct_alt in msg.number_to_strings(self.property_count)):
         self.set_result(1, random.choice(msg.congratulations))
Example #3
0
 def check_response(self, event):
     # check if the answer matches any of the possible ways of expressing
     # the correct number.
     # NB: note that here a longer digit string ending with the currect
     # number will be considered correct (e.g., 321 when the correct answer
     # is 1)
     if any(
             event.is_message(correct_alt, '.')
             for correct_alt in msg.number_to_strings(self.property_count)):
         self.set_reward(1, random.choice(msg.congratulations))
 def check_response(self, event):
     # check if the answer matches any of the possible ways of expressing
     # the correct number.
     # NB: note that here a longer digit string ending with the currect
     # number will be considered correct (e.g., 321 when the correct answer
     # is 1)
     if any(event.is_message(correct_alt, '.')
            for correct_alt in msg.number_to_strings(self.object_count)):
         self.set_result(1, random.choice(msg.congratulations))
     else:
         feedback = 'the right answer is: {answer}. please try again. '.format(
             answer=msg.number_to_string(self.object_count))
         feedback += self.question
         self.set_message(feedback)
Example #5
0
 def check_response(self, event):
     # check if the answer matches any of the possible ways of expressing
     # the correct number.
     # NB: note that here a longer digit string ending with the currect
     # number will be considered correct (e.g., 321 when the correct answer
     # is 1)
     if any(
             event.is_message(correct_alt, '.')
             for correct_alt in msg.number_to_strings(self.object_count)):
         self.set_reward(1, random.choice(msg.congratulations))
     else:
         feedback = 'the right answer is: {answer}. please try again. '.format(
             answer=msg.number_to_string(self.object_count))
         feedback += self.question
         self.set_message(feedback)