57 lines
1.4 KiB
Python
57 lines
1.4 KiB
Python
import sys
|
|
import time
|
|
import pygame
|
|
import regal
|
|
import paczka
|
|
from wozek import Wozek
|
|
from wyszukiwanie import Stan, SearchSpace, Search
|
|
|
|
pygame.init()
|
|
screen = pygame.display.set_mode((980, 980))
|
|
miejsce = pygame.image.load('images/miejsce_paczek.png')
|
|
|
|
pygame.display.set_caption("Inteligentny wozek")
|
|
icon = pygame.image.load('images/icon.png')
|
|
pygame.display.set_icon(icon)
|
|
|
|
def main():
|
|
|
|
wozek = Wozek(0,0)
|
|
|
|
grid_points = SearchSpace()
|
|
|
|
goal_state = Stan(5, 2, 0)
|
|
|
|
path = Search(grid_points).wyszukiwanie_bfs(wozek.state, goal_state)
|
|
|
|
if path:
|
|
for p in path:
|
|
wozek._move(p)
|
|
screen.fill((51,51,51)) # removes object trail
|
|
screen.blit(miejsce, (430, 400))
|
|
regal.Regal(1, 1, 2, 2)
|
|
regal.Regal(2, 1, 2, 3)
|
|
regal.Regal(3, 1, 3, 2)
|
|
regal.Regal(4, 1, 3, 3)
|
|
|
|
regal.Regal(5, 1, 8, 2)
|
|
regal.Regal(6, 1, 8, 3)
|
|
regal.Regal(7, 1, 9, 2)
|
|
regal.Regal(8, 1, 9, 3)
|
|
|
|
regal.Regal(9, 1, 2, 8)
|
|
regal.Regal(10, 1, 2, 9)
|
|
regal.Regal(11, 1, 3, 8)
|
|
regal.Regal(12, 1, 3, 9)
|
|
|
|
regal.Regal(13, 1, 8, 8)
|
|
regal.Regal(14, 1, 8, 9)
|
|
regal.Regal(15, 1, 9, 8)
|
|
regal.Regal(16, 1, 9, 9)
|
|
wozek.draw_bfs()
|
|
pygame.display.flip()
|
|
time.sleep(1)
|
|
|
|
if __name__ == "__main__":
|
|
main()
|