def bootstrap_agent(): agent_host = bootstrap_specific(world_file, clients, 0) agent = CLAgent.build(agent_host, map_file) while agent.host().getWorldState().is_mission_running: time.sleep(1) agent.observe(join=True)
def bootstrap_human(): agent_host = bootstrap_specific(world_file, clients, 1) agent = MalmoAgent.build(agent_host) time.sleep(3) agent.speak(SpeechTMR.build("Go to the grocery store."), join=True) time.sleep(14) agent.speak(SpeechTMR.build("Actually, go to the pharmacy first."), join=True) while agent.host().getWorldState().is_mission_running: time.sleep(2)
def bootstrap_sasha(): agent_host = bootstrap_specific( ("tests.resources", "multiexample.xml"), clients, 0) agent = MalmoAgent.build(agent_host) action = False while agent.host().getWorldState().is_mission_running: time.sleep(2) if not action: tmr = SpeechTMR.build("Hello world.") agent.speak(tmr, join=True) action = True
def bootstrap_sasha(): agent_host = bootstrap_specific(("tests.resources", "25world.xml"), clients, 0) agent = CLAgent.build(agent_host, None) action = False time.sleep(1) while user.host().getWorldState().is_mission_running: time.sleep(1) if not action: tmr = SpeechTMR.build( "My name is Ozymandias, king of agents: Look on my works, ye Mighty, and despair!" ) user.speak(tmr, join=True) action = True user.observe(join=True)
def bootstrap_agent(): agent_host = bootstrap_specific( ("worldtest.resources", "multiworld.xml"), clients, 1) agent = CLAgent.build(agent_host, None) # The agent needs to know who the User is, so the input signal can be attributed to the speaker correctly. user = Frame("@ENV.AGENT.?").add_parent("@ONT.AGENT") user["HAS-NAME"] = "User" # Disable all of the other signal observations for optimization of this example. from ontocraft.observers.position import PositionSignal from ontocraft.observers.vision import SupervisionSignal # agent.disable_observer(PositionSignal) # agent.disable_observer(SupervisionSignal) # Make sure Jake knows how to respond to an analyzed speech act. agent.add_response(Frame("@ONT.SPEECH-ACT"), CommandHandleExecutable) while agent.host().getWorldState().is_mission_running: time.sleep(1) agent.observe(join=True, chat_debug=True)
def bootstrap_jake(): agent_host = bootstrap_specific( ("tests.resources", "multiexample.xml"), clients, 1) agent = MalmoAgent.build(agent_host) # Jake needs to know who Sasha is, so the input signal can be attributed to the speaker correctly. sasha = Frame("@ENV.AGENT.?").add_parent("@ONT.AGENT") sasha["HAS-NAME"] = "Sasha" # Disable all of the other signal observations for optimization of this example. from ontocraft.observers.position import PositionSignal from ontocraft.observers.vision import SupervisionSignal agent.disable_observer(PositionSignal) agent.disable_observer(SupervisionSignal) # Make sure Jake knows how to respond to an analyzed speech act. agent.add_response(Frame("@ONT.SPEECH-ACT"), RespondToChatExecutable) while agent.host().getWorldState().is_mission_running: time.sleep(2) agent.observe(join=True)
def bootstrap_user(): agent_host = bootstrap_specific( ("worldtest.resources", "multiworld.xml"), clients, 0)