def setUp(self): self.memory = AgentMemory( load_minecraft_specs=False) # don't load specs, it's slow self.agent = FakeAgent(self.memory) self.dialogue_manager = TtadModelDialogueManager( self.agent, None, None, None, no_ground_truth_actions=True) # More helpful error message to encourage test writers to use self.set_looking_at() self.agent.get_player_line_of_sight = Mock( side_effect=NotImplementedError( "Cannot call into C++ function in this unit test. " + "Call self.set_looking_at() to set the return value")) # Add a speaker at position (5, 63, 5) looking in the +x direction self.memory.update(self.agent) self.speaker = list(self.memory.other_players.values())[0].name
def setUp(self, agent_opts=None): spec = {"players": [SimpleHuman(make_human_opts())], "agent": {"pos": (0, 0)}} world_opts = Opt() world_opts.sl = 32 self.world = World(world_opts, spec) self.agent = FakeAgent(self.world, opts=agent_opts) # More helpful error message to encourage test writers to use self.set_looking_at() self.agent.get_player_line_of_sight = Mock( side_effect=NotImplementedError( "Cannot call into C++ function in this unit test. " + "Call self.set_looking_at() to set the return value" ) ) self.speaker = self.agent.get_other_players()[0].name self.agent.perceive()
def setUp(self, agent_opts=None): spec = { "players": [Player(42, "SPEAKER", Pos(5, 63, 5), Look(270, 0), Item(0, 0))], "mobs": [], "item_stacks": [], "ground_generator": flat_ground_generator, "agent": {"pos": (0, 63, 0)}, "coord_shift": (-16, 54, -16), } world_opts = Opt() world_opts.sl = 32 self.world = World(world_opts, spec) self.agent = FakeAgent(self.world, opts=agent_opts) self.set_looking_at((0, 63, 0)) self.speaker = self.agent.get_other_players()[0].name self.agent.perceive()
def setUp(self): self.testing_agent = FakeAgent()
def setUp(self): self.memory = AgentMemory(load_minecraft_specs=False) # don't load specs, it's slow self.agent = FakeAgent(self.memory) self.dialogue_manager = TtadModelDialogueManager( self.agent, None, None, None, None, None, no_ground_truth_actions=True ) # More helpful error message to encourage test writers to use self.set_looking_at() self.agent.get_player_line_of_sight = Mock( side_effect=NotImplementedError( "Cannot call into C++ function in this unit test. " + "Call self.set_looking_at() to set the return value" ) ) # Add a speaker at position (5, 63, 5) looking in the +x direction self.memory.update(self.agent) self.speaker = list(self.memory.other_players.values())[0].name # Combinable actions to be used in test cases self.possible_actions = { "destroy_speaker_look": { "action_type": "DESTROY", "reference_object": {"location": {"location_type": "SPEAKER_LOOK"}}, }, "copy_speaker_look_to_agent_pos": { "action_type": "BUILD", "reference_object": {"location": {"location_type": "SPEAKER_LOOK"}}, "location": {"location_type": "AGENT_POS"}, }, "build_small_sphere": { "action_type": "BUILD", "schematic": {"has_name": "sphere", "has_size": "small"}, }, "build_1x1x1_cube": { "action_type": "BUILD", "schematic": {"has_name": "cube", "has_size": "1 x 1 x 1"}, }, "move_speaker_pos": { "action_type": "MOVE", "location": {"location_type": "SPEAKER_POS"}, }, "build_diamond": {"action_type": "BUILD", "schematic": {"has_name": "diamond"}}, "build_gold_cube": { "action_type": "BUILD", "schematic": {"has_block_type": "gold", "has_name": "cube"}, }, "fill_all_holes_speaker_look": { "action_type": "FILL", "location": {"location_type": "SPEAKER_LOOK"}, "repeat": {"repeat_key": "ALL"}, }, "go_to_tree": { "action_type": "MOVE", "location": { "location_type": "REFERENCE_OBJECT", "reference_object": {"has_name": "tree"}, }, }, "build_square_height_1": { "action_type": "BUILD", "schematic": {"has_name": "square", "has_height": "1"}, }, "stop": {"action_type": "STOP"}, "fill_speaker_look": { "action_type": "FILL", "location": {"location_type": "SPEAKER_LOOK"}, }, "fill_speaker_look_gold": { "action_type": "FILL", "has_block_type": "gold", "location": {"location_type": "SPEAKER_LOOK"}, }, }
def setUp(self, agent_opts=None): spec = { "players": [Player(42, "SPEAKER", Pos(5, 63, 5), Look(270, 0), Item(0, 0))], "mobs": [], "ground_generator": flat_ground_generator, "agent": { "pos": (0, 63, 0) }, "coord_shift": (-16, 54, -16), } world_opts = Opt() world_opts.sl = 32 self.world = World(world_opts, spec) self.agent = FakeAgent(self.world, opts=agent_opts) # More helpful error message to encourage test writers to use self.set_looking_at() self.agent.get_player_line_of_sight = Mock( side_effect=NotImplementedError( "Cannot call into C++ function in this unit test. " + "Call self.set_looking_at() to set the return value")) self.speaker = self.agent.get_other_players()[0].name self.agent.perceive() # Combinable actions to be used in test cases self.possible_actions = { "destroy_speaker_look": { "action_type": "DESTROY", "reference_object": { "location": { "location_type": "SPEAKER_LOOK" } }, }, "copy_speaker_look_to_agent_pos": { "action_type": "BUILD", "reference_object": { "location": { "location_type": "SPEAKER_LOOK" } }, "location": { "location_type": "AGENT_POS" }, }, "build_small_sphere": { "action_type": "BUILD", "schematic": { "has_name": "sphere", "has_size": "small" }, }, "build_1x1x1_cube": { "action_type": "BUILD", "schematic": { "has_name": "cube", "has_size": "1 x 1 x 1" }, }, "move_speaker_pos": { "action_type": "MOVE", "location": { "location_type": "SPEAKER_POS" }, }, "build_diamond": { "action_type": "BUILD", "schematic": { "has_name": "diamond" } }, "build_gold_cube": { "action_type": "BUILD", "schematic": { "has_block_type": "gold", "has_name": "cube" }, }, "fill_all_holes_speaker_look": { "action_type": "FILL", "location": { "location_type": "SPEAKER_LOOK" }, "repeat": { "repeat_key": "ALL" }, }, "go_to_tree": { "action_type": "MOVE", "location": { "location_type": "REFERENCE_OBJECT", "reference_object": { "has_name": "tree" }, }, }, "build_square_height_1": { "action_type": "BUILD", "schematic": { "has_name": "square", "has_height": "1" }, }, "stop": { "action_type": "STOP" }, "fill_speaker_look": { "action_type": "FILL", "location": { "location_type": "SPEAKER_LOOK" }, }, "fill_speaker_look_gold": { "action_type": "FILL", "has_block_type": "gold", "location": { "location_type": "SPEAKER_LOOK" }, }, }
opts = Opt() opts.sl = 32 spec = { "players": [Player(42, "SPEAKER", Pos(0, 68, 0), Look(270, 80), Item(0, 0))], "mobs": [SimpleMob(make_mob_opts("cow")), SimpleMob(make_mob_opts("chicken"))], "agent": { "pos": (1, 68, 1) }, "coord_shift": (-opts.sl // 2, 63 - opts.sl // 2, -opts.sl // 2), } world = World(opts, spec) agent = FakeAgent(world, opts=None) speaker_name = agent.get_other_players()[0].name move_speaker_pos = { "action_type": "MOVE", "location": { "location_type": "SPEAKER_POS" } } build_small_sphere = { "action_type": "BUILD", "schematic": { "has_name": "sphere", "has_size": "small" }, }