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


Python OpenNero.enable_ai方法代码示例

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


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

示例1: parseInputCommand

# 需要导入模块: import OpenNero [as 别名]
# 或者: from OpenNero import enable_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

示例2: Match

# 需要导入模块: import OpenNero [as 别名]
# 或者: from OpenNero import enable_ai [as 别名]
def Match(team0, team1):
    '''Run a single battle between two population files.'''
    mod = module.getMod()
    mod.load_team(team0, constants.OBJECT_TYPE_TEAM_0)
    mod.load_team(team1, constants.OBJECT_TYPE_TEAM_1)
    mod.set_speedup(100)
    OpenNero.enable_ai()
开发者ID:baviera08,项目名称:opennero,代码行数:9,代码来源:main.py

示例3: deploy

# 需要导入模块: import OpenNero [as 别名]
# 或者: from OpenNero import enable_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

示例4: start_fps

# 需要导入模块: import OpenNero [as 别名]
# 或者: from OpenNero import enable_ai [as 别名]
 def start_fps(self):
     print 'start_fps was called'
     if self.first_person_agent is None:
         print 'adding first person agent!'
         self.spawnAgent(agent_xml = 'data/shapes/character/FirstPersonAgent.xml')
         OpenNero.enable_ai()
     else:
         print 'removing first person agent!'
         common.removeObject(self.first_person_agent)
         self.first_person_agent = None
开发者ID:chyt,项目名称:CS343-Hw5,代码行数:12,代码来源:module.py

示例5: start_my_planner_2_disk

# 需要导入模块: import OpenNero [as 别名]
# 或者: from OpenNero import enable_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

示例6: start_tower1

# 需要导入模块: import OpenNero [as 别名]
# 或者: from OpenNero import enable_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_nlp_extended

# 需要导入模块: import OpenNero [as 别名]
# 或者: from OpenNero import enable_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

示例8: start_tower3

# 需要导入模块: import OpenNero [as 别名]
# 或者: from OpenNero import enable_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 enable_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: parseInputCommand

# 需要导入模块: import OpenNero [as 别名]
# 或者: from OpenNero import enable_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

示例11: add_bots

# 需要导入模块: import OpenNero [as 别名]
# 或者: from OpenNero import enable_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

示例12: start_demonstration

# 需要导入模块: import OpenNero [as 别名]
# 或者: from OpenNero import enable_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

示例13: start_agent_state_space_search

# 需要导入模块: import OpenNero [as 别名]
# 或者: from OpenNero import enable_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

示例14: parseInput

# 需要导入模块: import OpenNero [as 别名]
# 或者: from OpenNero import enable_ai [as 别名]
def parseInput(strn):
    if strn == "deploy" or len(strn) < 2:
        return
    mod = getMod()
    # first word is command rest is filename
    loc, val = strn.split(' ',1)
    vali = 1
    if strn.isupper():
        vali = int(val)
    if loc == "HP": mod.hpChange(vali)
    if loc == "SP": mod.set_speedup(vali)
    if loc == "load1": mod.load_team(val, constants.OBJECT_TYPE_TEAM_0)
    if loc == "load2": mod.load_team(val, constants.OBJECT_TYPE_TEAM_1)
    if loc == "rtneat":
        mod.deploy('rtneat', constants.OBJECT_TYPE_TEAM_0)
        mod.deploy('rtneat', constants.OBJECT_TYPE_TEAM_1)
    if loc == "qlearning":
        mod.deploy('qlearning', constants.OBJECT_TYPE_TEAM_0)
        mod.deploy('qlearning', constants.OBJECT_TYPE_TEAM_1)
    if loc == "pause": OpenNero.disable_ai()
    if loc == "resume": OpenNero.enable_ai()
开发者ID:DavidDeAngelo,项目名称:opennero,代码行数:23,代码来源:module.py

示例15: start_rtneat

# 需要导入模块: import OpenNero [as 别名]
# 或者: from OpenNero import enable_ai [as 别名]
 def start_rtneat(self):
     """ start the rtneat learning stuff"""
     self.spawnAgent()
     OpenNero.enable_ai()
开发者ID:chyt,项目名称:CS343-Hw5,代码行数:6,代码来源:module.py


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