Update main.py
This commit is contained in:
parent
0529f89343
commit
4858436e9e
24
src/main.py
24
src/main.py
@ -25,12 +25,12 @@ def get_position_from_pix(pix_pos):
|
||||
|
||||
WAREHOUSE_MAP = [
|
||||
[0, 0, 0, 10, 10, 0, 0, 0, 0],
|
||||
[0, 10, 0, 10, 0, 10, 0, 0, 0],
|
||||
[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, 10, 0, 0, 0, 0, 0],
|
||||
[10, 0, 0, 0, 10, 200, 200, 200, 200],
|
||||
[10, 10, 0, 10, 0, 10, 0, 0, 0],
|
||||
[10, 10, 0, 0, 0, 200, 200, 200, 200],
|
||||
[10, 0, 10, 0, 0, 0, 0, 0, 0],
|
||||
[10, 10, 10, 0, 0, 200, 200, 200, 200],
|
||||
[10, 10, 10, 10, 0, 0, 0, 0, 0],
|
||||
[10, 10, 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],
|
||||
]
|
||||
@ -226,7 +226,6 @@ class NodeAStar:
|
||||
return self.position == other.position
|
||||
|
||||
|
||||
|
||||
class Node:
|
||||
def __init__(self, state, agent_direction, action=None, parent=None):
|
||||
self.state = state
|
||||
@ -410,10 +409,8 @@ class Agent:
|
||||
|
||||
board = pygame.Surface((WIDTH, HEIGHT), pygame.SRCALPHA) # transparently surface
|
||||
|
||||
|
||||
create_positions()
|
||||
|
||||
|
||||
# Rysowanie lini
|
||||
for x in range(9):
|
||||
for y in range(9):
|
||||
@ -439,24 +436,22 @@ Package_list = [
|
||||
generate_package(40, 40)
|
||||
]
|
||||
|
||||
|
||||
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[1], agent.pos_coord[0]), (0, 0), agent.agent_direction)
|
||||
|
||||
|
||||
print(agent.path)
|
||||
|
||||
|
||||
Stain_list = []
|
||||
# Pętla służąca do tworzenia plam oleju na podstawie mapy magazynu
|
||||
for index_x in range(9):
|
||||
for index_y in range(9):
|
||||
if WAREHOUSE_MAP[index_x][index_y] == 10:
|
||||
Stain_list.append(Stain((index_y, index_x)))
|
||||
running = True
|
||||
|
||||
|
||||
running = True
|
||||
while running:
|
||||
time.sleep(0.25)
|
||||
for event in pygame.event.get():
|
||||
@ -498,7 +493,8 @@ while running:
|
||||
agent.goal_achieved = False
|
||||
|
||||
# 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)
|
||||
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])
|
||||
|
Loading…
Reference in New Issue
Block a user