`Проект IA в Python - UnboundLocalError: локальная переменная «х» обращаться до присвоения
def iterativeDeepeningSearch(problem):
def depthLimitedDFS(node, problem, depth):
if depth==0:
return
if problem.isGoalState(node[-1]):
return node
for move, acao, c in problem.getSuccessors(node[-1]):
if move not in node:
ode = depthLimitedDFS(node+[move],problem, depth-1)
if x:
return x
for depth in itertools.count():
node = depthLimitedDFS([problem.getStartState()], problem, depth)
if node:
return node`
Я пытаюсь выполнить этот код в проект (Pacman), но она возвращает ошибку: Un связаны Local Ошибка: локальная переменная «х» обращаться до присвоения ....
У вас есть строка 'if x:', но не определена переменная 'x' ... – CoryKramer
Я забыл повернуть переменную 'ode' в 'x' – Costa