18 Jun
2022
18 Jun
'22
4:13 a.m.
---------------------- structure generator that reuses spots def StructureGenerator def __init__(self): self.generated = [] def update(self, time): num_generated = 0 num_to_generate = 1 for idx, structure in enumerate(self.generated): if structure is None or not structure.update(time): if num_generated < num_to_generate: self.generated[idx] = self.new_structure() else: self.generated[idx] = None while num_generated < num_to_generate: self.generated.append(self.new_structure()) def new_structure(self): # override return self.Structure()