import copy
from typing import Any, Dict, Union
from axelrod.action import Action
from axelrod.player import Player
lIIlllIIIIlIII, lIlIIlllIIlIllllIlI = Action.C, Action.D
class IllIlIIllll(Player):
    IIlIlIIlIlllI = "strategy"
    IIIIlIIl = {
        "stochastic": False,
        "inspects_source": False,
        "long_run_time": False,
        "manipulates_source": False,
        "manipulates_state": False,
        "memory_depth": float("inf"),
    }  
    def __init__(
        lIlllIIllllIl, lIIlIIlIIIllIIlII: Union[int, float] = float("inf"), IIlIIllIlIIII: bool = True
    ) -> None:
        super().__init__()
        lIlllIIllllIl.IIlIIllIlIIII = IIlIIllIlIIII
        lIlllIIllllIl.IIIIlIIl["memory_depth"] = lIIlIIlIIIllIIlII
        if lIlllIIllllIl.IIIIlIIl["memory_depth"] < float("inf"):
            lIlllIIllllIl.llIlIIlllIIllIllI = lIlllIIllllIl.IIIIlIIl["memory_depth"]
        else:
            lIlllIIllllIl.llIlIIlllIIllIllI = 0
        lIlllIIllllIl.IIlIlIIlIlllI = "Go By Majority" + (lIlllIIllllIl.llIlIIlllIIllIllI > 0) * (
            ": %i" % lIlllIIllllIl.llIlIIlllIIllIllI
        )
        if lIlllIIllllIl.IIlIIllIlIIII:
            lIlllIIllllIl.IIlIlIIlIlllI = "Soft " + lIlllIIllllIl.IIlIlIIlIlllI
        else:
            lIlllIIllllIl.IIlIlIIlIlllI = "Hard " + lIlllIIllllIl.IIlIlIIlIlllI
    def IIlIIIllllIlI(lIlllIIllllIl):
        return lIlllIIllllIl.IIlIlIIlIlllI
    def IIlIIllllIllIlIIII(lIlllIIllllIl, lIIlIllIlllllIlI: Player) -> Action:
        lIlIIlIIIIIIIIlI = lIIlIllIlllllIlI.lIlIIlIIIIIIIIlI[-lIlllIIllllIl.llIlIIlllIIllIllI :]
        IlllIIIIlll = sum([llIlIllllllIIIl == lIlIIlllIIlIllllIlI for llIlIllllllIIIl in lIlIIlIIIIIIIIlI])
        IIIIIIIIlIlIllll = sum([llIlIllllllIIIl == lIIlllIIIIlIII for llIlIllllllIIIl in lIlIIlIIIIIIIIlI])
        if IlllIIIIlll > IIIIIIIIlIlIllll:
            return lIlIIlllIIlIllllIlI
        if IlllIIIIlll == IIIIIIIIlIlIllll:
            if lIlllIIllllIl.IIlIIllIlIIII:
                return lIIlllIIIIlIII
            else:
                return lIlIIlllIIlIllllIlI
        return lIIlllIIIIlIII
class llllIIlIl(IllIlIIllll):
    IIlIlIIlIlllI = "strategy"
    def __init__(lIlllIIllllIl, lIIlIIlIIIllIIlII: Union[int, float] = float("inf")) -> None:
        super().__init__(lIIlIIlIIIllIIlII=lIIlIIlIIIllIIlII, IIlIIllIlIIII=False)
class IllIIlllIIllIlllIl(llllIIlIl):
    IIlIlIIlIlllI = "strategy"
    IIIIlIIl = copy.copy(IllIlIIllll.IIIIlIIl)
    IIIIlIIl["memory_depth"] = 20
    def __init__(lIlllIIllllIl) -> None:
        super().__init__(lIIlIIlIIIllIIlII=20)