def on_start(self, event):
ws = self.get_world().state
# pick a random object
self.state.target_obj, = random.sample(objects, 1)
# give one of it to the learner
ws.learner_inventory[self.state.target_obj] += 1
# save how many objects of this we have
self.state.initial_count = ws.teacher_inventory[self.state.target_obj]
# inform the world that we can expect to receive such an object
ws.teacher_accepts.add(self.state.target_obj)
self.set_message("I gave you {indef_object}. Give it back to me "
"by saying \"I give you {indef_object}\"."
.format(indef_object=msg.indef_article(
self.state.target_obj)))
# if I have one more of the target object, the learner solved the task.
评论列表
文章目录