# module for abstract classes from abc import ABC, abstractmethod # type hints from typing import Tuple from disarming.parameters.mine_parameters import MineParameters # Mine cannot be instantiated # all abstract methods must be implemented in derived classes class Mine(ABC): @abstractmethod def __init__(self, _type, position: Tuple[int, int], active=True): self.enum_type = _type self.position = position self.wire = None self.active = active @abstractmethod def disarm(self, wire): if wire == self.wire: self.active = False return True else: return False @abstractmethod def investigate(self): mine_parameters = MineParameters(mine_type=self.enum_type).jsonifyable_dict() wire = mine_parameters["wire"] del mine_parameters["wire"] self.wire = wire return mine_parameters