本文整理汇总了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