Files
python-bootcamp/simulation/Simulation.py
T
2023-04-03 23:19:16 -07:00

31 lines
747 B
Python

from abc import ABC, abstractmethod
class Simulation(ABC):
@abstractmethod
def start(self):
"Start the simulated object."
pass
@abstractmethod
def tick(self) -> bool:
"""
Simulate one clock tick.
Returns:
bool: True if the simulation could advance one clock tick, or False if the object is expired.
"""
pass
@abstractmethod
def use(self, *args, **kwargs):
"""
Use the simulated object.
Args:
args (tuple): A tuple of arguments.
kwargs (dict): A dictionary of key-value pairs of arguments.
"""
pass
@abstractmethod
def stop(self):
"Stop the simulated object."
pass