mazeFinder.py
def actions(self, node):
        '''
        Used to get the list of actions that can occur for a given state.
        Actions that can't be done aren't added to the action list.
        returns a list of actions.
        '''
        state = node.state
        walls = state[2]
        actionList = ["Move Up", "Move Down", "Move Right", "Move Left"]
        block = pygame.Rect(state[0], state[1]-1, BLOCKSIZE, BLOCKSIZE)
        for wall in walls:
            if block.colliderect(wall.rect):
                del actionList[actionList.index("Move Up")]
                break
        block.y =state[1]+1
        for wall in walls:
            if block.colliderect(wall.rect):
                del actionList[actionList.index("Move Down")]
                break
        block.y = state[1]
        block.x = state[0]+1
        for wall in walls:
            if block.colliderect(wall.rect):
                del actionList[actionList.index("Move Right")]
                break
        block.x = state[0]-1
        for wall in walls:
            if block.colliderect(wall.rect):
                del actionList[actionList.index("Move Left")]
                break
        return actionList

        Used to get the list of actions that can occur for a given state.
        Actions that can't be done aren't added to the action list.
        returns a list of actions.
        
Used to get the list of actions that can occur for a given state.
Actions that can't be done aren't added to the action list.
returns a list of actions.
Used to get the list of actions that can occur for a given state . Actions that can ' t be done aren ' t added to the action list . returns a list of actions .
def actions(self, node):
        state = node.state
        walls = state[2]
        actionList = ["Move Up", "Move Down", "Move Right", "Move Left"]
        block = pygame.Rect(state[0], state[1]-1, BLOCKSIZE, BLOCKSIZE)
        for wall in walls:
            if block.colliderect(wall.rect):
                del actionList[actionList.index("Move Up")]
                break
        block.y =state[1]+1
        for wall in walls:
            if block.colliderect(wall.rect):
                del actionList[actionList.index("Move Down")]
                break
        block.y = state[1]
        block.x = state[0]+1
        for wall in walls:
            if block.colliderect(wall.rect):
                del actionList[actionList.index("Move Right")]
                break
        block.x = state[0]-1
        for wall in walls:
            if block.colliderect(wall.rect):
                del actionList[actionList.index("Move Left")]
                break
        return actionList
def actions ( self , node ) : state = node . state walls = state [ 2 ] actionList = [ "Move Up" , "Move Down" , "Move Right" , "Move Left" ] block = pygame . Rect ( state [ 0 ] , state [ 1 ] - 1 , BLOCKSIZE , BLOCKSIZE ) for wall in walls : if block . colliderect ( wall . rect ) : del actionList [ actionList . index ( "Move Up" ) ] break block . y = state [ 1 ] + 1 for wall in walls : if block . colliderect ( wall . rect ) : del actionList [ actionList . index ( "Move Down" ) ] break block . y = state [ 1 ] block . x = state [ 0 ] + 1 for wall in walls : if block . colliderect ( wall . rect ) : del actionList [ actionList . index ( "Move Right" ) ] break block . x = state [ 0 ] - 1 for wall in walls : if block . colliderect ( wall . rect ) : del actionList [ actionList . index ( "Move Left" ) ] break return actionList
Used to get the list of actions that can occur for a given state.
Used to get the list of actions that can occur for a given state .
'''
        Used to get the list of actions that can occur for a given state.
        Actions that can't be done aren't added to the action list.
        returns a list of actions.
        '''
self
node