2023-05-08 11:27:16 +02:00
|
|
|
import random
|
2023-06-15 17:58:27 +02:00
|
|
|
import algorytm_genetyczny as genetic
|
2023-05-08 11:27:16 +02:00
|
|
|
|
|
|
|
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-31 09:25:37 +02:00
|
|
|
if wymiar == 0:
|
|
|
|
return 0
|
|
|
|
else:
|
|
|
|
while (i < wymiar):
|
|
|
|
pixele = pixele + 70
|
|
|
|
i = i + 1
|
|
|
|
return pixele
|
2023-05-08 11:27:16 +02:00
|
|
|
|
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
|
|
|
|
|
2023-06-15 17:58:27 +02:00
|
|
|
najlepszy_osobnik = genetic.ewolucja()
|
|
|
|
print("Generowana plansza:")
|
|
|
|
genetic.print_board(najlepszy_osobnik)
|
2023-05-08 11:27:16 +02:00
|
|
|
|
2023-06-15 17:58:27 +02:00
|
|
|
(x1, y1), (x2, y2), (x3, y3), (x4, y4), (a, b), (c, d) = najlepszy_osobnik[:6]
|
2023-05-30 21:00:08 +02:00
|
|
|
|
|
|
|
x1, x2, x3, x4, y1, y2, y3, y4 = map(int, [x1, x2, x3, x4, y1, y2, y3, y4])
|
2023-05-08 11:27:16 +02:00
|
|
|
|
|
|
|
a_pix = obliczPixeleNaPodstawieKratek(a)
|
2023-05-31 09:25:37 +02:00
|
|
|
b_pix = obliczPixeleNaPodstawieKratek(b)
|
|
|
|
|
|
|
|
c_pix = obliczPixeleNaPodstawieKratek(c)
|
|
|
|
d_pix = obliczPixeleNaPodstawieKratek(d)
|