GenericAI_Sweeper/pizza.py
eugenep f0e0d4f4c1 decision tree update
Co-authored-by: Sebastian Piotrowski <sebpio@st.amu.edu.pl>
Co-authored-by: Marcin Matoga <marmat35@st.amu.edu.pl>
Co-authored-by: Ladislaus3III <Ladislaus3III@users.noreply.github.com>
2021-05-15 21:04:51 +02:00

73 lines
2.3 KiB
Python

#author: Kuba Henyk
import random
class ExampleGenerator():
@staticmethod
def generate():
list = [[]]
for i in range(200):
while True:
c = [random.randrange(0, 21), random.randrange(5, 41), random.randrange(1, 61), random.randrange(0, 11), random.randrange(0, 2), random.randrange(0, 2), random.randrange(0, 2), random.randrange(0, 2)]
if c in list:
continue
else:
break
list.append(c)
f = open("dane.txt", "w")
#f1 = open("dane_slownie.txt", "w")
#glebokosc rozmiar masa moc szkodliwosc zabawka stan teledysk
for i in range(len(list)):
if i != 0:
#zabawka
if list[i][5] == 1:
#teledysk
if list[i][7] == 1:
list[i].append(5)
else:
list[i].append(3)
else:
#glebokosc
if list[i][0] >= 19:
list[i].append(1)
else:
#masa
if list[i][2] >= 58:
list[i].append(1)
else:
#rozmiar
if list[i][1] >= 39:
list[i].append(1)
else:
#moc
if list[i][3] >= 9:
list[i].append(1)
else:
#szkodliwosc
if list[i][4] == 1:
list[i].append(1)
else:
#stan
if list[i][6] == 1:
list[i].append(4)
else:
list[i].append(2)
for i in range(len(list)):
if i == 0:
continue
else:
for j in range(len(list[i])):
f.write(str(list[i][j]) + ' ')
f.write("\n")
f.close()