def getNextPoint(self):
        """ Get the next point from the current point """

        points = self.getExitPoints(self._current)
        point = self.getBestPoint(points)
        
        while self.checkClosedLoop(point):

            if self.endlessLoop():
                point = None
                break
            
            # Save point
            point2 = point

            point = self.getNextClosestPointNotInPath(points, point2)
            if not point:
                # Try retracing path
                point = self.retracePath()
                
        return point
 Get the next point from the current point 
recipes/Python/496884_Amaze__objectoriented_maze_generatorsolver/recipe-496884.py