class Plant(): def _init_(self): @property def is_alive(self): pass @property def ttl(self): pass @property def hydration(self): pass @property def soil_level(self): pass @property def dehydration_ratio(self): pass @property def max_soil_lvl(self): pass @property def optimal_soil_ratio(self): pass @property def max_hydration_lvl(self): pass @property def optimal_hydration_ratio(self): pass @property def ready(self): pass @property def name(self): pass def get_stats(self): return {"ttl": self.ttl, "is_alive": self.is_alive, "hydration": self.hydration, "soil_level": self.soil_level, "ready": self.ready, "name": self.name } #np. touple'a z info czy żyje, ile ma wody i nawozu def get_symbol(self): if not self.is_alive: return ('x', None) if self.name == 1 and self.hydration > (500) and self.soil_level > (400): # (self.max_soil_lvl / self.optimal_soil_ratio): return ('p', "green") if (self.ttl > self.ready) \ else ('P', "green") elif self.name == 0 and self.hydration > (600) and self.soil_level > (500): return ('o', "green") if (self.ttl > self.ready) \ else ('O', "green") else: if self.name == 1: return ('p', "yellow") if (self.ttl > self.ready) \ else ('P', "yellow") else: return ('o', "yellow") if (self.ttl > self.ready) \ else ('O', "yellow") def tick(self, n): self.decrease_ttl(n) self.decrase_hydration(n) self.decrease_soillevel(n) def decrease_ttl(self, n): self.ttl -= n if self.ttl == 0: self.is_alive = False if n==0: self.is_alive = False def increase_hydration(self, n): self.hydration += n if self.hydration > self.max_hydration_lvl: self.is_alive = False def decrase_hydration(self, n): self.hydration -= (n * self.dehydration_ratio) if self.hydration < 1: self.is_alive = False def increase_soillevel(self, n): self.soil_level += n if self.soil_level > self.max_soil_lvl: self.is_alive = False def decrease_soillevel(self, n): self.soil_level -= (n * self.desoil_ratio) if self.soil_level < 1: self.is_alive = False