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


Python Individual.get_robot方法代码示例

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


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

示例1: init_node_type_test

# 需要导入模块: from individual import Individual [as 别名]
# 或者: from individual.Individual import get_robot [as 别名]
    def init_node_type_test(self):
        """Puts Test in known state for Node type tests."""

        self.clear_test_state()
        player1 = Individual()
        player2 = Individual()
        testee = player1.get_robot()
        testee.location = constants.testee_loc
        ally = player1.get_robot()
        ally.location = constants.ally_loc
        enemy = player2.get_robot()
        enemy.location = constants.enemy_loc
        enemy.player_id = 1
        self.robots = [testee, ally, enemy]
        for bot in self.robots:
            self.gamestate.add_robot(bot.location, bot.player_id)
            
        # I use the default 'guard' action to determine when a rule evaluates 
        #     False, so the test rule must not be the guard rule
        while testee.eval_order[0].action == 'guard':
            random.shuffle(testee.eval_order)
        testee.eval_order[0].insert_random_parent()
开发者ID:andrewgailey,项目名称:robogen,代码行数:24,代码来源:robogentest.py

示例2: init_children_test

# 需要导入模块: from individual import Individual [as 别名]
# 或者: from individual.Individual import get_robot [as 别名]
    def init_children_test(self, num_children):

        self.clear_test_state()
        player1 = Individual()
        testee = player1.get_robot()
        testee.location = constants.testee_loc
        self.robots = [testee]
        self.gamestate.add_robot(testee.location, testee.player_id)
        
        # Force the prime rule to be the move rule so direction is returned
        while testee.eval_order[0].action != 'move':
            random.shuffle(testee.eval_order)
        
        rule = self.robots[0].eval_order[0]
        rule.insert_random_parent()
        for x in range(num_children):
            self.insert_random_root_child(rule)
开发者ID:andrewgailey,项目名称:robogen,代码行数:19,代码来源:robogentest.py


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