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


Python State.direction_to_move方法代码示例

本文整理汇总了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)]
开发者ID:siegelhorn,项目名称:cs370-project,代码行数:31,代码来源:Driver_MPI.py


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