当前位置: 首页>>代码示例>>Python>>正文


Python OpenNero.disable_ai方法代码示例

本文整理汇总了Python中OpenNero.disable_ai方法的典型用法代码示例。如果您正苦于以下问题:Python OpenNero.disable_ai方法的具体用法?Python OpenNero.disable_ai怎么用?Python OpenNero.disable_ai使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OpenNero的用法示例。


在下文中一共展示了OpenNero.disable_ai方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: load_team

# 需要导入模块: import OpenNero [as 别名]
# 或者: from OpenNero import disable_ai [as 别名]
 def load_team(self, location, team=constants.OBJECT_TYPE_TEAM_0):
     NERO.module.NeroModule.load_team(self, location, team)
     rtneat = OpenNero.get_ai('rtneat-%s' % team)
     if rtneat:
         rtneat.set_lifetime(sys.maxint)
         rtneat.disable_evolution()
     OpenNero.disable_ai() # don't run until button
开发者ID:DavidDeAngelo,项目名称:opennero,代码行数:9,代码来源:module.py

示例2: ClientMain

# 需要导入模块: import OpenNero [as 别名]
# 或者: from OpenNero import disable_ai [as 别名]
def ClientMain():
    # physics off, ai off by default
    # disable_physics()
    OpenNero.disable_ai()

    if not module.getMod().setup_map():
        inputConfig.switchToHub()
        return

    # add a light source
    OpenNero.getSimContext().addLightSource(OpenNero.Vector3f(500, -500, 1000), 1500)

    # common.addSkyBox("data/sky/irrlicht2")

    # setup the gui
    CreateGui(common.getGuiManager())

    # add a camera
    camRotateSpeed = 100
    camMoveSpeed = 15000
    camZoomSpeed = 200
    cam = OpenNero.getSimContext().addCamera(camRotateSpeed, camMoveSpeed, camZoomSpeed)
    cam.setFarPlane(40000)
    cam.setEdgeScroll(False)
    recenter_cam = recenter(cam)
    recenter_cam()

    # create the io map
    ioMap = inputConfig.createInputMapping()
    ioMap.BindKey("KEY_SPACE", "onPress", recenter_cam)
    OpenNero.getSimContext().setInputMapping(ioMap)
开发者ID:bradyz,项目名称:cs343,代码行数:33,代码来源:client.py

示例3: parseInputCommand

# 需要导入模块: import OpenNero [as 别名]
# 或者: from OpenNero import disable_ai [as 别名]
def parseInputCommand(content):
    """
    Parse commands from training window
    """
    mod = getMod()
    command, arg = content.attrib['command'], content.attrib['arg']
    # first word is command rest is filename
    if command.isupper():
        vali = int(arg)
    if command == "LT": mod.ltChange(vali)
    if command == "EE": mod.eeChange(vali)
    if command == "HP": mod.hpChange(vali)
    if command == "SP": mod.set_speedup(vali)
    if command == "save1": mod.save_team(arg, constants.OBJECT_TYPE_TEAM_0)
    if command == "load1": mod.load_team(arg, constants.OBJECT_TYPE_TEAM_0)
    if command == "rtneat": mod.deploy('rtneat')
    if command == "qlearning": mod.deploy('qlearning')
    if command == "pause": OpenNero.disable_ai()
    if command == "resume": OpenNero.enable_ai()
    if command == "example":
        print 'command: example'
        if arg == "start":
            print 'command: example start'
            mod.start_demonstration()
        elif arg == "cancel":
            print 'command: example cancel'
            OpenNero.get_environment().cancel_demonstration()
        elif arg == "confirm":
            print 'command: example confirm'
            OpenNero.get_environment().use_demonstration()
开发者ID:gjacobrobertson,项目名称:opennero-394n,代码行数:32,代码来源:module.py

示例4: deploy

# 需要导入模块: import OpenNero [as 别名]
# 或者: from OpenNero import disable_ai [as 别名]
 def deploy(self, ai='rtneat', team=constants.OBJECT_TYPE_TEAM_0):
     OpenNero.disable_ai()
     if ai == 'rtneat':
         OpenNero.set_ai('rtneat-%s' % team, None)
     self.environment.remove_all_agents(team)
     for _ in range(constants.pop_size):
         self.spawnAgent(ai=ai, team=team)
     OpenNero.enable_ai()
开发者ID:PCoelho07,项目名称:opennero,代码行数:10,代码来源:module.py

示例5: start_nlp_extended

# 需要导入模块: import OpenNero [as 别名]
# 或者: from OpenNero import disable_ai [as 别名]
def start_nlp_extended(): #Natural Language Processing
    """ start the tower demo """
    getMod().num_disks = 3
    OpenNero.disable_ai()
    getMod().stop_agent()
    env = TowerEnvironment()
    env.initialize_blocks()
    getMod().set_environment(env)
    getMod().agent_id = common.addObject("data/shapes/character/MyNLPRobot.xml", OpenNero.Vector3f(TowerofHanoi.constants.GRID_DX, TowerofHanoi.constants.GRID_DY, 2), type=TowerofHanoi.constants.AGENT_MASK, scale=OpenNero.Vector3f(3,3,3))
    OpenNero.enable_ai()
开发者ID:bradyz,项目名称:cs343,代码行数:12,代码来源:main.py

示例6: start_tower1

# 需要导入模块: import OpenNero [as 别名]
# 或者: from OpenNero import disable_ai [as 别名]
 def start_tower1(self): #Problem reduction
     """ start the tower demo """
     self.num_disks = 3
     OpenNero.disable_ai()
     self.stop_agent()
     env = TowerEnvironment()
     env.initialize_blocks()
     self.set_environment(env)
     self.agent_id = common.addObject("data/shapes/character/BlocksRobot.xml", OpenNero.Vector3f(constants.GRID_DX, constants.GRID_DY, 2), type=constants.AGENT_MASK, scale=OpenNero.Vector3f(3,3,3))
     OpenNero.enable_ai()
开发者ID:PCoelho07,项目名称:opennero,代码行数:12,代码来源:module.py

示例7: start_my_planner_2_disk

# 需要导入模块: import OpenNero [as 别名]
# 或者: from OpenNero import disable_ai [as 别名]
def start_my_planner_2_disk():
    """ start the tower demo """
    getMod().num_disks = 2
    OpenNero.disable_ai()
    getMod().stop_agent()
    env = TowerEnvironment()
    env.initialize_blocks()
    getMod().set_environment(env)
    getMod().agent_id = common.addObject("data/shapes/character/MyPlanningRobot2.xml", OpenNero.Vector3f(TowerofHanoi.constants.GRID_DX, TowerofHanoi.constants.GRID_DY, 2), type=TowerofHanoi.constants.AGENT_MASK, scale=OpenNero.Vector3f(3,3,3))
    OpenNero.enable_ai()
开发者ID:chyt,项目名称:CS343-Hw2,代码行数:12,代码来源:main.py

示例8: start_tower3

# 需要导入模块: import OpenNero [as 别名]
# 或者: from OpenNero import disable_ai [as 别名]
 def start_tower3(self): #2 Disk Goal Stack Planner
     """ start the tower demo """
     self.num_disks = 2
     OpenNero.disable_ai()
     self.stop_agent()
     env = TowerEnvironment()
     env.initialize_blocks()
     self.set_environment(env)
     #self.set_environment(TowerEnvironment())
     self.agent_id = common.addObject("data/shapes/character/BlocksRobot3.xml", OpenNero.Vector3f(constants.GRID_DX, constants.GRID_DY, 2), type=constants.AGENT_MASK, scale=OpenNero.Vector3f(3,3,3))
     OpenNero.enable_ai()
开发者ID:PCoelho07,项目名称:opennero,代码行数:13,代码来源:module.py

示例9: start_rtneat

# 需要导入模块: import OpenNero [as 别名]
# 或者: from OpenNero import disable_ai [as 别名]
 def start_rtneat(self, pop_size):
     " start the rtneat learning demo "
     OpenNero.disable_ai()
     #self.environment = RoombaEnvironment(constants.XDIM, constants.YDIM, self)
     #set_environment(self.environment)
     #self.reset_sandbox()
     # Create RTNEAT object
     rbound = OpenNero.FeatureVectorInfo()
     rbound.add_continuous(-sys.float_info.max, sys.float_info.max)
     rtneat = OpenNero.RTNEAT("data/ai/neat-params.dat", 2, 1, pop_size, 1.0, rbound, False)
     rtneat.set_weight(0,1)
     OpenNero.set_ai("rtneat",rtneat)
     OpenNero.enable_ai()
     self.distribute_bots(pop_size, "data/shapes/roomba/RoombaRTNEAT.xml")
开发者ID:JimmyLin192,项目名称:MultiagentSystem,代码行数:16,代码来源:module.py

示例10: setup_map

# 需要导入模块: import OpenNero [as 别名]
# 或者: from OpenNero import disable_ai [as 别名]
    def setup_map(self):
        """
        setup the test environment
        """
        OpenNero.disable_ai()

        if self.environment:
            error("Environment already created")
            return
        self.environment = self.create_environment()
        OpenNero.set_environment(self.environment)
        self.environment.setup()

        return True
开发者ID:baviera08,项目名称:opennero,代码行数:16,代码来源:module.py

示例11: parseInputCommand

# 需要导入模块: import OpenNero [as 别名]
# 或者: from OpenNero import disable_ai [as 别名]
def parseInputCommand(content):
    """
    Parse commands from training window
    """
    mod = getMod()
    command, arg = content.attrib['command'], content.attrib['arg']
    # first word is command rest is filename
    if command.isupper():
        vali = int(arg)
    if command == "save1": mod.save_team(arg, constants.OBJECT_TYPE_TEAM_0)
    if command == "load1": mod.load_team(arg, constants.OBJECT_TYPE_TEAM_0)
    if command == "rtneat": mod.deploy('rtneat', 'neat')
    if command == "qlearning": mod.deploy('none', 'qlearning')
    if command == "pause": OpenNero.disable_ai()
    if command == "resume": OpenNero.enable_ai()
开发者ID:baviera08,项目名称:opennero,代码行数:17,代码来源:module.py

示例12: add_bots

# 需要导入模块: import OpenNero [as 别名]
# 或者: from OpenNero import disable_ai [as 别名]
 def add_bots(self, bot_type, num_bots):
     OpenNero.disable_ai()
     num_bots = int(num_bots)
     if bot_type.lower().find("script") >= 0:
         self.distribute_bots(num_bots, "data/shapes/roomba/Roomba.xml")
         OpenNero.enable_ai()
         return True
     elif bot_type.lower().find("rtneat") >= 0:
         self.start_rtneat(num_bots)
         return True
     elif bot_type.lower().find("rlagent") >= 0:
         self.distribute_bots(num_bots, "data/shapes/roomba/RLAgent.xml")
         OpenNero.enable_ai()
         return True
     else:
         return False
开发者ID:JimmyLin192,项目名称:MultiagentSystem,代码行数:18,代码来源:module.py

示例13: start_demonstration

# 需要导入模块: import OpenNero [as 别名]
# 或者: from OpenNero import disable_ai [as 别名]
 def start_demonstration(self):
     '''
     start the keyboard agent to collect demonstration example
     '''
     OpenNero.disable_ai()
     team = constants.OBJECT_TYPE_TEAM_0
     self.curr_team = team
     #self.environment.remove_all_agents(team)
     location = (self.spawn_x[team], self.spawn_y[team], 2)
     agnt = common.addObject(
         "data/shapes/character/steve_keyboard.xml",
         position = OpenNero.Vector3f(*location),
         type=team)
     OpenNero.enable_ai()
     self.environment.start_tracing()
     return agnt
开发者ID:gjacobrobertson,项目名称:opennero-394n,代码行数:18,代码来源:module.py

示例14: start_agent_state_space_search

# 需要导入模块: import OpenNero [as 别名]
# 或者: from OpenNero import disable_ai [as 别名]
 def start_agent_state_space_search(self):  # State-space search
     """ start the tower demo """
     self.num_disks = 3
     OpenNero.disable_ai()
     self.stop_agent()
     env = TowerEnvironment()
     env.initialize_blocks()
     self.set_environment(env)
     # self.set_environment(TowerEnvironment())
     self.agent_id = common.addObject(
         "data/shapes/character/BlocksRobot2.xml",
         OpenNero.Vector3f(constants.GRID_DX, constants.GRID_DY, 2),
         type=constants.AGENT_MASK,
         scale=OpenNero.Vector3f(3, 3, 3),
     )
     OpenNero.enable_ai()
开发者ID:vurte,项目名称:opennero,代码行数:18,代码来源:module.py

示例15: ClientMain

# 需要导入模块: import OpenNero [as 别名]
# 或者: from OpenNero import disable_ai [as 别名]
def ClientMain():
    global modify_object_id
    global object_ids
    global guiMan

    OpenNero.disable_ai()

    if not module.getMod().setup_map():
        switchToHub()
        return

    # add a light source
    OpenNero.getSimContext().addLightSource(OpenNero.Vector3f(500, -500, 1000), 1500)

    common.addSkyBox("data/sky/irrlicht2")

    # setup the gui
    guiMan = common.getGuiManager()
    object_ids = {}
    modify_object_id = {}

    # add a camera
    camRotateSpeed = 100
    camMoveSpeed   = 15000
    camZoomSpeed   = 200
    cam = OpenNero.getSimContext().addCamera(camRotateSpeed, camMoveSpeed, camZoomSpeed)
    cam.setFarPlane(40000)
    cam.setEdgeScroll(False)

    def recenter(cam):
        def closure():
            cam.setPosition(OpenNero.Vector3f(0, 0, 100))
            cam.setTarget(OpenNero.Vector3f(100, 100, 0))
        return closure

    recenter_cam = recenter(cam)
    recenter_cam()

    # create the io map
    ioMap = createInputMapping()
    ioMap.BindKey("KEY_SPACE", "onPress", recenter_cam)
    OpenNero.getSimContext().setInputMapping(ioMap)
开发者ID:DavidDeAngelo,项目名称:opennero,代码行数:44,代码来源:client.py


注:本文中的OpenNero.disable_ai方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。