import copy
from typing import Any, Dict, Union
from axelrod.action import Action
from axelrod.player import Player
IllllIIIlIlIlIIl, lIlIllIIIlIIIIll = Action.C, Action.D
class IIlIllIlIIllI(Player):
    IIlIlllIlIIlllI = "strategy"
    IIIIlllIlIlllI = {
        "stochastic": False,
        "inspects_source": False,
        "long_run_time": False,
        "manipulates_source": False,
        "manipulates_state": False,
        "memory_depth": float("inf"),
    }  
    def __init__(
        IIlIIlIlIIlIllIlll, llIlllll: Union[int, float] = float("inf"), IIIlIllIlllIllllI: bool = True
    ) -> None:
        super().__init__()
        IIlIIlIlIIlIllIlll.IIIlIllIlllIllllI = IIIlIllIlllIllllI
        IIlIIlIlIIlIllIlll.IIIIlllIlIlllI["memory_depth"] = llIlllll
        if IIlIIlIlIIlIllIlll.IIIIlllIlIlllI["memory_depth"] < float("inf"):
            IIlIIlIlIIlIllIlll.lIlIllllll = IIlIIlIlIIlIllIlll.IIIIlllIlIlllI["memory_depth"]
        else:
            IIlIIlIlIIlIllIlll.lIlIllllll = 0
        IIlIIlIlIIlIllIlll.IIlIlllIlIIlllI = "Go By Majority" + (IIlIIlIlIIlIllIlll.lIlIllllll > 0) * (
            ": %i" % IIlIIlIlIIlIllIlll.lIlIllllll
        )
        if IIlIIlIlIIlIllIlll.IIIlIllIlllIllllI:
            IIlIIlIlIIlIllIlll.IIlIlllIlIIlllI = "Soft " + IIlIIlIlIIlIllIlll.IIlIlllIlIIlllI
        else:
            IIlIIlIlIIlIllIlll.IIlIlllIlIIlllI = "Hard " + IIlIIlIlIIlIllIlll.IIlIlllIlIIlllI
    def IIIllllII(IIlIIlIlIIlIllIlll):
        return IIlIIlIlIIlIllIlll.IIlIlllIlIIlllI
    def lIlIllIIIlIIlI(IIlIIlIlIIlIllIlll, IIlIIllllIllIllI: Player) -> Action:
        llllIlII = IIlIIllllIllIllI.llllIlII[-IIlIIlIlIIlIllIlll.lIlIllllll :]
        IlIIIlIlIllIllllI = sum([IlIllIlIll == lIlIllIIIlIIIIll for IlIllIlIll in llllIlII])
        lllIIIlIl = sum([IlIllIlIll == IllllIIIlIlIlIIl for IlIllIlIll in llllIlII])
        if IlIIIlIlIllIllllI > lllIIIlIl:
            return lIlIllIIIlIIIIll
        if IlIIIlIlIllIllllI == lllIIIlIl:
            if IIlIIlIlIIlIllIlll.IIIlIllIlllIllllI:
                return IllllIIIlIlIlIIl
            else:
                return lIlIllIIIlIIIIll
        return IllllIIIlIlIlIIl
class lIlIIllIIlllIIlIIlIl(IIlIllIlIIllI):
    IIlIlllIlIIlllI = "strategy"
    IIIIlllIlIlllI = copy.copy(IIlIllIlIIllI.IIIIlllIlIlllI)
    IIIIlllIlIlllI["memory_depth"] = 20
    def __init__(IIlIIlIlIIlIllIlll) -> None:
        super().__init__(llIlllll=20)