當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。