Merge branch 'yaku-astar' of https://git.wmi.amu.edu.pl/s444360/SI_2020 into yaku-astar
This commit is contained in:
commit
ef76909342
2
agent.py
2
agent.py
@ -80,7 +80,6 @@ class Agent:
|
|||||||
|
|
||||||
def get_neighbours(self, node: Node):
|
def get_neighbours(self, node: Node):
|
||||||
neighbours = []
|
neighbours = []
|
||||||
print(neighbours)
|
|
||||||
if self.check_if_can_move(Coordinates(node.x + 1, node.y)):
|
if self.check_if_can_move(Coordinates(node.x + 1, node.y)):
|
||||||
neighbours.append(Node(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)):
|
if self.check_if_can_move(Coordinates(node.x - 1, node.y)):
|
||||||
@ -97,6 +96,7 @@ class Agent:
|
|||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
next = self.path.pop()
|
next = self.path.pop()
|
||||||
|
print(next.x, next.y)
|
||||||
self.x = next.x
|
self.x = next.x
|
||||||
self.y = next.y
|
self.y = next.y
|
||||||
self.closed = []
|
self.closed = []
|
||||||
|
6
main.py
6
main.py
@ -4,7 +4,7 @@ import agent
|
|||||||
import random
|
import random
|
||||||
import sys
|
import sys
|
||||||
from attributes import PackSize, PackStatus, COLORS
|
from attributes import PackSize, PackStatus, COLORS
|
||||||
import pdb
|
|
||||||
WINDOW_SIZE = (600, 600)
|
WINDOW_SIZE = (600, 600)
|
||||||
COLOR_OF_FIELD = {
|
COLOR_OF_FIELD = {
|
||||||
'Floor': 'gray',
|
'Floor': 'gray',
|
||||||
@ -34,11 +34,9 @@ class MainGameFrame:
|
|||||||
self.draw_floor()
|
self.draw_floor()
|
||||||
self.draw_packages()
|
self.draw_packages()
|
||||||
self.draw_agent()
|
self.draw_agent()
|
||||||
# pdb.set_trace()
|
|
||||||
self.agent.move()
|
self.agent.move()
|
||||||
pygame.display.update()
|
pygame.display.update()
|
||||||
# pdb.set_trace()
|
self.clock.tick(1)
|
||||||
self.clock.tick(2)
|
|
||||||
|
|
||||||
def draw_floor(self):
|
def draw_floor(self):
|
||||||
for x in range(self.warehouse_map.width):
|
for x in range(self.warehouse_map.width):
|
||||||
|
Loading…
Reference in New Issue
Block a user