from Simulation import Simulation class HotdogSimulation(Simulation): def __init__(self) -> None: self.bites_left = 5 self.ticks_left = 10 # Temperature in degC self.temperature = 20 def get_uses(self): # The trailing comma is to ensure a tuple is returned instead of a string. return { 'eat': "Eat one bite of the hot dog.", 'microwave': "Put the hot dog in the microwave for 30 seconds." } def start(self): print(f"DEBUG: simulation started.") def use(self, *args, **kwargs) -> bool: if 'eat' in args: print(f"DEBUG: someone ate the hot dog! 🌭") self.bites_left -= 1 if self.bites_left == 0: print(f"DEBUG: no more hot dog left! 🌭") return False if 'microwave' in args: print(f"DEBUG: someone microwaved the hot dog! 🌭") self.temperature += 40 if self.temperature > 100: print(f"DEBUG: hot dog got too hot and exploded! 🌭") return False else: print(f"DEBUG: someone used the hot dog! 🌭") return True def tick(self): self.ticks_left -= 1 self.temperature -= 10 if self.ticks_left == 0: print(f"DEBUG: simulation out of ticks, expiring.") return False return True def stop(self): print(f"DEBUG: simulation stopped.") pass