本文整理汇总了Python中State.State.direction_to_move方法的典型用法代码示例。如果您正苦于以下问题:Python State.direction_to_move方法的具体用法?Python State.direction_to_move怎么用?Python State.direction_to_move使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类State.State
的用法示例。
在下文中一共展示了State.direction_to_move方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_smart_move
# 需要导入模块: from State import State [as 别名]
# 或者: from State.State import direction_to_move [as 别名]
def get_smart_move(score_map, possible_states):
# UNTESTED
move_counts = {}
move_counts[Moves.FORWARD] = 0
move_counts[Moves.BACKWARD] = 0
move_counts[Moves.LEFT] = 0
move_counts[Moves.RIGHT] = 0
for possible_state in possible_states:
if score_map.get_tile(possible_state.point) is None: continue
desired_directions = score_map.get_tile(possible_state.point).directions
for desired_direction in desired_directions:
desired_move = State.direction_to_move(possible_state.direction, desired_direction)
move_counts[desired_move] += 1
max_count = -1
max_moves_ties = []
for move in Moves:
move_count = move_counts[move]
if move_count > max_count:
max_count = move_count
max_moves_ties = [move]
elif move_count == max_count:
#tie between max_move and move
print("********TIE********")
max_moves_ties.append(move)
pass
return max_moves_ties[randint(0,len(max_moves_ties)-1)]