AbsAlgPart

fukurou

the supreme coder
ADMIN
Python:
from __future__ import annotations
from abc import ABC, abstractmethod
from enum import Enum

'''
Failure types:
- ok: no fail
- requip: item should be added
- cloudian: algorithm goes to stand by in its Dclass
- fail: no input
'''


class enumFail(Enum):
    fail = "fail"
    requip = "requip"
    dequip = "dequip"
    cloudian = "cloudian"
    ok = "ok"


class AbsAlgPart:
    @abstractmethod
    def action(self, ear: str, skin: str, eye: str) -> str:
        '''Returns action string'''
        ...
# depracated :
    # @abstractmethod
    # def itemize(self) -> bool:
    #    '''Equip with item ?'''
    #    pass

    @abstractmethod
    def failure(self, input: str) -> enumFail:
        '''Failure type only mutatable may use enumFail.fail'''
        pass

    @abstractmethod
    def completed(self) -> bool:
        '''Has finished ?'''
        pass

    @abstractmethod
    def clone(self) -> AbsAlgPart:
        pass

    def getMutationLimit(self) -> int:
        return 0

    @abstractmethod
    def myName(self) -> str:
        '''Returns the class name'''
        return self.__class__.__name__


class APSay(AbsAlgPart):
    def action(self, ear: str, skin: str, eye: str) -> str:
        return f"ear {ear} skin:{skin} eye{eye}"

    def itemize(self) -> bool:
        return False
 
Top