2023-05-08 11:27:16 +02:00
|
|
|
import random
|
|
|
|
|
|
|
|
def obliczPixeleNaPodstawieKratek(wymiar): #Przeliczanie współrzędnych podanych w kratkach na pixele
|
|
|
|
i = 1
|
2023-05-29 00:13:02 +02:00
|
|
|
pixele = 70
|
2023-05-08 11:27:16 +02:00
|
|
|
while (i < wymiar):
|
|
|
|
pixele = pixele + 70
|
|
|
|
i = i + 1
|
|
|
|
return pixele
|
|
|
|
|
2023-05-27 23:50:48 +02:00
|
|
|
EKRAN_SZEROKOSC = 770
|
|
|
|
EKRAN_WYSOKOSC = 770
|
2023-05-08 11:27:16 +02:00
|
|
|
blockSize = 70
|
|
|
|
|
|
|
|
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)
|
|
|
|
|
|
|
|
#wspolrzedne miejsca paczek
|
|
|
|
a = random.randint(1, EKRAN_SZEROKOSC // blockSize - 2)
|
|
|
|
b = random.randint(1, EKRAN_SZEROKOSC // blockSize - 2)
|
|
|
|
|
|
|
|
coords = [(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)]
|
|
|
|
|
|
|
|
#sprawdzenie czy jakies wspolrzedne sie pokrywaja
|
|
|
|
if len(coords) == len(set(coords)):
|
|
|
|
break
|
|
|
|
|
|
|
|
x1, x2, x3, x4, y1, y2, y3, y4, a, b = map(int, [x1, x2, x3, x4, y1, y2, y3, y4, a, b])
|
|
|
|
|
|
|
|
a_pix = obliczPixeleNaPodstawieKratek(a)
|
|
|
|
b_pix = obliczPixeleNaPodstawieKratek(b)
|