From fc588a4ad52b266d4fa64420004e49b0eaee970a Mon Sep 17 00:00:00 2001 From: Mateusz Szlachetka Date: Thu, 20 Apr 2023 10:01:48 +0200 Subject: [PATCH] fixed search --- bfs.py | 5 +++-- main.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/bfs.py b/bfs.py index 0e29f49..3f219da 100644 --- a/bfs.py +++ b/bfs.py @@ -14,8 +14,9 @@ def bfs(istate, goalx, goaly): return steps element = successors(state) - explored.append(state) + explored.append((state.xpos, state.ypos, state.orientation)) for value in element : - if value not in explored and value not in fringe: + val = (value.xpos, value.ypos, value.orientation) + if val not in explored: fringe.append(value) return False diff --git a/main.py b/main.py index 90191dc..b9b865a 100644 --- a/main.py +++ b/main.py @@ -68,7 +68,7 @@ def main(): run = False #keys_pressed = pygame.key.get_pressed() draw_window(agent, fields) - steps = bfs(State(None, None, 0, 0, 'E'), 250, 100) + steps = bfs(State(None, None, 0, 0, 'E'), 250, 700) for interm in steps: if interm.action == 'LEFT': agent.direction = (agent.direction - 1) % 4