Beispiel #1
0
 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
Beispiel #2
0
 def getLegalActions(state):
     """
     Returns a list of possible actions.
     """
     return Actions.getPossibleActions(state.getPacmanState().configuration, state.data.layout.walls)