本文整理匯總了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
示例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
示例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
示例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