From 0529f893435e9f279fecb6d37b1c268039585c9d Mon Sep 17 00:00:00 2001 From: Miron Date: Sun, 9 May 2021 23:01:08 +0200 Subject: [PATCH] Update main.py --- src/main.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main.py b/src/main.py index f60bbbf..2e3a132 100644 --- a/src/main.py +++ b/src/main.py @@ -29,9 +29,9 @@ WAREHOUSE_MAP = [ [0, 10, 0, 0, 0, 200, 200, 200, 200], [0, 0, 10, 0, 0, 0, 0, 0, 0], [0, 0, 10, 0, 0, 200, 200, 200, 200], - [0, 0, 10, 0, 0, 0, 0, 0, 0], - [10, 0, 0, 0, 0, 200, 200, 200, 200], - [0, 0, 0, 10, 0, 0, 0, 0, 0], + [0, 0, 10, 10, 0, 0, 0, 0, 0], + [10, 0, 0, 0, 10, 200, 200, 200, 200], + [0, 0, 10, 10, 10, 0, 0, 0, 0], [0, 10, 0, 0, 0, 200, 200, 200, 200], ] @@ -319,7 +319,7 @@ class Stain: class Agent: def __init__(self, pos, agent_direction="right"): self.pos = pos - self.pos_coord = (get_position_from_pix(pos)[1], get_position_from_pix(pos)[0]) + self.pos_coord = get_position_from_pix(pos) self.image = IMAGE self.rect = self.image.get_rect(center=pos) self.goal = (0, 0) @@ -443,7 +443,7 @@ Package_list = [ print(a_star_search((6, 8), (0, 0), "down")) #agent.path = breadth_first_search(agent.pos_coord, agent.agent_direction) -agent.path = a_star_search(agent.pos_coord, (0, 0), agent.agent_direction) +agent.path = a_star_search((agent.pos_coord[1], agent.pos_coord[0]), (0, 0), agent.agent_direction) print(agent.path) @@ -497,8 +497,8 @@ while running: agent.goal = coord_goals.pop(0) agent.goal_achieved = False - #agent.path = breadth_first_search(agent.pos_coord, agent.agent_direction) - agent.path = a_star_search(agent.pos_coord, agent.goal, agent.agent_direction) + # agent.path = breadth_first_search(agent.pos_coord, agent.agent_direction) + agent.path = a_star_search((agent.pos_coord[1], agent.pos_coord[0]), (agent.goal[1], agent.goal[0]), agent.agent_direction) # DRAWING screen.blit(BACKGROUND, [0, 0])