import random from classes.Trash import * class Garbage: def __init__(self): self.full = random.randint(0, 2) self.content = [] self.known = [] self.prob: float = 0.3 self.generateKnown() self.generateContent() self.known = tuple(self.known) def getContent(self): return self.content def getFull(self): return self.full def setContent(self, content): self.content = content return self def addContent(self, item: Trash): self.content.append(item) return self def removeContent(self, item: int): return self.content.remove(item) def getKnown(self): return self.known def setKnown(self, predict): self.known = predict return self def addKnown(self, item): self.known.append(item) return self def getProb(self): return self.prob def setProb(self, prob): self.prob = prob return self def generateKnown(self, i=random.choice([2, 3])): if i < 0: self.known.pop(i) else: for _ in range(i): possible = [Papier(), MetalPlastik(), Szklo(), Mixed(), Bio()] traf = random.choice(possible) self.known.append(traf) for bruh in possible: if bruh != traf: del bruh def generateContent(self): self.setContent(self.known[:]) if random.random() < self.prob: mod = random.choice([1, -1]) self.generateKnown(mod)