from succ import succ as successors def bfs(istate, goalx, goaly): fringe = [istate] explored = [] steps = [] while(fringe): state = fringe.pop(0) if state.xpos == goalx and state.ypos == goaly: steps.insert(0, state) while(state.parent != None): state = state.parent steps.insert(0, state) return steps element = successors(state) explored.append((state.xpos, state.ypos, state.orientation)) for value in element : val = (value.xpos, value.ypos, value.orientation) if val not in explored: fringe.append(value) return False