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


Python Actions.reverseDirection方法代码示例

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


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

示例1: getLegalActions

# 需要导入模块: from game import Actions [as 别名]
# 或者: from game.Actions import reverseDirection [as 别名]
def getLegalActions( state, ghostIndex ):
        """
        Ghosts cannot stop, and cannot turn around unless they
        reach a dead end, but can turn 90 degrees at intersections.
        """
        conf = state.getGhostState( ghostIndex ).configuration
        possibleActions = Actions.getPossibleActions( conf, state.data.layout.walls )
        reverse = Actions.reverseDirection( conf.direction )
        if Directions.STOP in possibleActions:
            possibleActions.remove( Directions.STOP )
        if reverse in possibleActions and len( possibleActions ) > 1:
            possibleActions.remove( reverse )
        return possibleActions 
开发者ID:AUTBS,项目名称:AI-Pacman,代码行数:15,代码来源:pacman.py

示例2: getLegalActions

# 需要导入模块: from game import Actions [as 别名]
# 或者: from game.Actions import reverseDirection [as 别名]
def getLegalActions( state, ghostIndex ):
    """
    Ghosts cannot stop, and cannot turn around unless they
    reach a dead end, but can turn 90 degrees at intersections.
    """
    conf = state.getGhostState( ghostIndex ).configuration
    possibleActions = Actions.getPossibleActions( conf, state.data.layout.walls )
    reverse = Actions.reverseDirection( conf.direction )
    if Directions.STOP in possibleActions:
      possibleActions.remove( Directions.STOP )
    if reverse in possibleActions and len( possibleActions ) > 1:
      possibleActions.remove( reverse )
    return possibleActions 
开发者ID:jrios6,项目名称:Berkeley-AI-PacMan-Lab-1,代码行数:15,代码来源:pacman.py

示例3: getLegalActions

# 需要导入模块: from game import Actions [as 别名]
# 或者: from game.Actions import reverseDirection [as 别名]
def getLegalActions( state, ghostIndex ):
        """
        Ghosts cannot stop, and cannot turn around unless they
        reach a dead end, but can turn 90 degrees at intersections.
        """
        conf = state.getGhostState( ghostIndex ).configuration
        possibleActions = Actions.getPossibleActions( conf, state.data.layout.walls )
        reverse = Actions.reverseDirection( conf.direction )
        # Our ghosts are a little different
        #if Directions.STOP in possibleActions:
        #    possibleActions.remove( Directions.STOP )
        #if reverse in possibleActions and len( possibleActions ) > 1:
        #    possibleActions.remove( reverse )
        return possibleActions 
开发者ID:aig-upf,项目名称:2017-planning-with-simulators,代码行数:16,代码来源:pacman.py

示例4: getLegalActions

# 需要导入模块: from game import Actions [as 别名]
# 或者: from game.Actions import reverseDirection [as 别名]
def getLegalActions( state, ghostIndex ):
        """
        Ghosts cannot stop, and cannot turn around unless they
        reach a dead end, but can turn 90 degrees at intersections.
        """
        conf = state.getGhostState( ghostIndex ).configuration
        possibleActions = Actions.getPossibleActions( conf, state.data.layout.walls )
        reverse = Actions.reverseDirection( conf.direction )
        if Directions.STOP not in possibleActions:
            possibleActions.add( Directions.STOP )
        #if reverse in possibleActions and len( possibleActions ) > 1:
            #possibleActions.remove( reverse )
        return possibleActions 
开发者ID:mttk,项目名称:AIclass,代码行数:15,代码来源:pacman.py


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