本文整理汇总了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()
示例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)