本文整理汇总了Python中state.State.map_action方法的典型用法代码示例。如果您正苦于以下问题:Python State.map_action方法的具体用法?Python State.map_action怎么用?Python State.map_action使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类state.State
的用法示例。
在下文中一共展示了State.map_action方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: act
# 需要导入模块: from state import State [as 别名]
# 或者: from state.State import map_action [as 别名]
def act(self, game):
new_robot = self.robot_id in self.robot_ids
self.robot_ids.add(self.robot_id)
self.current_state = State.from_game(game, self.player_id,
robot_loc=self.location)
self.game = game
# Explore function
if random.randint(0, 3) < 1:
print("[Bot " + str(self.robot_id) + "] random action")
# print self.state
action = self.get_random_action()
else:
action = self.qlearning.predict(self.current_state)
self.last_states[self.robot_id] = self.current_state
self.last_action[self.robot_id] = action
return State.map_action(action, self.location)