diff --git a/ekran.py b/ekran.py index a75ffa4..3e59c55 100644 --- a/ekran.py +++ b/ekran.py @@ -10,7 +10,7 @@ EKRAN_SZEROKOSC = 770 EKRAN_WYSOKOSC = 770 screen = pygame.display.set_mode((EKRAN_SZEROKOSC, EKRAN_WYSOKOSC)) miejsce = pygame.image.load('images/miejsce_paczek.png') -miejsce = pygame.transform.scale(miejsce, (140, 140)) +miejsce = pygame.transform.scale(miejsce, (70, 70)) pygame.display.set_caption("Inteligentny wozek") icon = pygame.image.load('images/icon.png') pygame.display.set_icon(icon) diff --git a/grid.py b/grid.py index 3909d4d..bb1d918 100644 --- a/grid.py +++ b/grid.py @@ -29,7 +29,7 @@ class SearchGrid: for c, d in [(x1, y1), (x1, y1+1), (x1+1, y1), (x1+1, y1+1), (x2, y2), (x2+1, y2), (x2, y2+1), (x2+1, y2+1), (x3, y3), (x3+1, y3), (x3, y3+1), (x3+1, y3+1), (x4, y4), (x4+1, y4), (x4, y4+1), (x4+1, y4+1),]: self.grid[(c,d)] = GridCellType.RACK - for e, f in [(a,b), (a+1,b), (a,b+1), (a+1,b+1)]: + for e, f in [(a,b)]: self.grid[(e,f)] = GridCellType.PLACE diff --git a/plansza.py b/plansza.py index d2f2546..e82212c 100644 --- a/plansza.py +++ b/plansza.py @@ -17,30 +17,40 @@ x1, y1, x2, y2, x3, y3, x4, y4 = [None] * 8 while True: #wspolrzedne regalow - x1 = random.randint(1, EKRAN_SZEROKOSC // blockSize - 2) - y1 = random.randint(1, EKRAN_SZEROKOSC // blockSize - 2) - x2 = random.randint(1, EKRAN_SZEROKOSC // blockSize - 2) - y2 = random.randint(1, EKRAN_SZEROKOSC // blockSize - 2) - x3 = random.randint(1, EKRAN_SZEROKOSC // blockSize - 2) - y3 = random.randint(1, EKRAN_SZEROKOSC // blockSize - 2) - x4 = random.randint(1, EKRAN_SZEROKOSC // blockSize - 2) - y4 = random.randint(1, EKRAN_SZEROKOSC // blockSize - 2) + x1 = random.randint(1, 3) + x2 = random.randint(1, 3) + x3 = random.randint(6, 8) + x4 = random.randint(6, 8) + + y1 = random.randint(1, 3) + y2 = random.randint(6, 8) + y3 = random.randint(1, 3) + y4 = random.randint(6, 8) #wspolrzedne miejsca paczek - a = random.randint(1, EKRAN_SZEROKOSC // blockSize - 2) - b = random.randint(1, EKRAN_SZEROKOSC // blockSize - 2) + a = 5 + b = 5 - coords = [(x1, y1), (x1+1, y1), (x1, y1+1), (x1+1, y1+1), + #dodane wspolrzedne (0, 0), (4, 4), (4, 6), (6, 4), (6, 6) zeby regaly sie nie stykaly + table = [(0, 0), (4, 4), (4, 6), (6, 4), (6, 6), + (x1, y1), (x1+1, y1), (x1, y1+1), (x1+1, y1+1), (x2, y2), (x2+1, y2), (x2, y2+1), (x2+1, y2+1), (x3, y3), (x3+1, y3), (x3, y3+1), (x3+1, y3+1), - (x4, y4), (x4+1, y4), (x4, y4+1), (x4+1, y4+1), - (a, b), (a+1, b), (a, b+1), (a+1, b+1)] + (x4, y4), (x4+1, y4), (x4, y4+1), (x4+1, y4+1)] #sprawdzenie czy jakies wspolrzedne sie pokrywaja - if len(coords) == len(set(coords)): + if len(table) == len(set(table)): break -x1, x2, x3, x4, y1, y2, y3, y4, a, b = map(int, [x1, x2, x3, x4, y1, y2, y3, y4, a, b]) +coordinates = [(x1, y1), (x2, y2), (x3, y3), (x4, y4)] + +#przemieszanie koordynatów w parach +random.shuffle(coordinates) + +#przypisanie przemieszanych wartości do zmiennych +(x1, y1), (x2, y2), (x3, y3), (x4, y4) = coordinates + +x1, x2, x3, x4, y1, y2, y3, y4 = map(int, [x1, x2, x3, x4, y1, y2, y3, y4]) a_pix = obliczPixeleNaPodstawieKratek(a) -b_pix = obliczPixeleNaPodstawieKratek(b) +b_pix = obliczPixeleNaPodstawieKratek(b) \ No newline at end of file diff --git a/wozek.py b/wozek.py index 6965b98..a867a2c 100644 --- a/wozek.py +++ b/wozek.py @@ -94,7 +94,7 @@ class Wozek(pygame.sprite.Sprite): def __zainicjuj_stan_poczatkowy(self): from wyszukiwanie import Stan - self.obecnyStan = Stan(70, 70, 1) + self.obecnyStan = Stan(0, 0, 1) def przemiesc_wozek_po_sciezce(self, sciezka): kierunek_poprzedni = self.obecnyStan.kierunek