This commit is contained in:
Miron 2021-05-09 23:47:56 +02:00
commit 8a403844f2
2 changed files with 41 additions and 7 deletions

33
docs/docs.md Normal file
View File

@ -0,0 +1,33 @@
# PROJEKT AI
### FUNKCJE I STRUKTURY
[`get_pix_from_position`](#####get_pix_from_position)
[`get_position_from_pix()`](#####get_position_from_pix())
[`create_positions()`](#####create_positions())
[`generate_package()`](#####generate_package())
[`breadth_first_search()`](#####breadth_first_search())
### KLASY
[`Node`](####Node)
[`Package`](####Package)
[`Shelf`](####Shelf)
[`Agent`](####Agent)
### MAIN
go to [`lol`](####LOL)
## FUNKCJE I STRUKTURY
##### get_pix_from_position
##### get_position_from_pix()
##### create_positions()
##### generate_package()
##### breadth_first_search()
## KLASY
#### Node
#### Package
#### Shelf
#### Agent
## MAIN

View File

@ -453,7 +453,7 @@ for index_x in range(9):
running = True
while running:
time.sleep(0.25)
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
@ -461,11 +461,7 @@ while running:
if event.type == pygame.KEYDOWN:
pass
for package in Package_list:
if package.is_package_up:
package.rect.move_ip(agent.pos[0] - package.pos[0], agent.pos[1] - package.pos[1])
package.pos = agent.pos
if len(Package_list) < QTY_OF_PACKAGES:
@ -481,11 +477,9 @@ while running:
# PATHING
if not agent.goal_achieved:
print(agent.path)
agent.move_bfs()
else:
time.sleep(.25)
agent.lift_package_bfs()
if coord_goals:
@ -496,6 +490,11 @@ while running:
agent.path = a_star_search((agent.pos_coord[1], agent.pos_coord[0]), (agent.goal[1], agent.goal[0]),
agent.agent_direction)
for package in Package_list:
if package.is_package_up:
package.rect.move_ip(agent.pos[0] - package.pos[0], agent.pos[1] - package.pos[1])
package.pos = agent.pos
# DRAWING
screen.blit(BACKGROUND, [0, 0])
screen.blit(DOCK, [0, 0])
@ -508,6 +507,8 @@ while running:
for package in Package_list:
screen.blit(package.image, package.rect)
time.sleep(0.15)
pygame.display.update()
pygame.quit()