Merge branch 'yaku-astar' of https://git.wmi.amu.edu.pl/s444360/SI_2020 into yaku-astar

This commit is contained in:
andrzej 2020-04-28 22:07:58 +02:00
commit ef76909342
2 changed files with 4 additions and 6 deletions

View File

@ -19,7 +19,7 @@ class Node:
def __repr__(self):
return "Node:{}x{}".format(self.x, self.y)
class Agent:
def __init__(self, start_x, start_y, assigned_warehouse, radius=5):
self.x = start_x
@ -80,7 +80,6 @@ class Agent:
def get_neighbours(self, node: Node):
neighbours = []
print(neighbours)
if self.check_if_can_move(Coordinates(node.x + 1, node.y)):
neighbours.append(Node(node.x + 1, node.y))
if self.check_if_can_move(Coordinates(node.x - 1, node.y)):
@ -97,6 +96,7 @@ class Agent:
return
else:
next = self.path.pop()
print(next.x, next.y)
self.x = next.x
self.y = next.y
self.closed = []

View File

@ -4,7 +4,7 @@ import agent
import random
import sys
from attributes import PackSize, PackStatus, COLORS
import pdb
WINDOW_SIZE = (600, 600)
COLOR_OF_FIELD = {
'Floor': 'gray',
@ -34,11 +34,9 @@ class MainGameFrame:
self.draw_floor()
self.draw_packages()
self.draw_agent()
# pdb.set_trace()
self.agent.move()
pygame.display.update()
# pdb.set_trace()
self.clock.tick(2)
self.clock.tick(1)
def draw_floor(self):
for x in range(self.warehouse_map.width):