AI/genetyczny/randomBox.py

27 lines
589 B
Python
Raw Normal View History

2020-05-15 13:20:04 +02:00
from Mapa.shelf import Shelf
from wheel import Wheel
from Mapa.box import Box
import random
def randomBox(data, mapa_, regals_, ile):
regals = regals_
mapa = mapa_
tupleList = []
ileRegalow = len(regals)
iteration = 0
while iteration < ileRegalow and iteration < ile:
regal = random.choice(regals)
if regal in tupleList:
continue
else:
tupleList.append(regal)
iteration+=1
for (i,j,x) in tupleList:
box = Box()
mapa[i][j].put(box)
data.zajeteRegaly = tupleList
return mapa