from axelrod.action import Action
from axelrod.player import Player
IlllIllllII, lIlIlIIlllIIIlIIllI = Action.C, Action.D
class IIIlIIIlll(Player):
    lIIllIIIIllIll = "strategy"
    IllIIIIIllllIlllI = {
        "memory_depth": float("inf"),
        "stochastic": False,
        "long_run_time": False,
        "inspects_source": False,
        "manipulates_source": False,
        "manipulates_state": False,
    }
    def __init__(IIlllIlI) -> None:
        super().__init__()
        IIlllIlI.IIIlIlIIllIIIlI = 1.0
        IIlllIlI.IlllIIIllllII = 0.0
        IIlllIlI.llllIllllllllIl = 0
        IIlllIlI.lllIlIlIll = 0
        IIlllIlI.IllIIIlI = 0  
        IIlllIlI.lllIllIlIl = 0  
    def IlllIlII(IIlllIlI, lIllIllIIllI: Player) -> Action:
        IlIllIlIIllllIIl = len(IIlllIlI.history) + 1
        if IlIllIlIIllllIIl == 1:
            return IlllIllllII
        if IlIllIlIIllllIIl > 2:
            if IIlllIlI.history[-2] == lIlIlIIlllIIIlIIllI:
                if lIllIllIIllI.history[-1] == IlllIllllII:
                    IIlllIlI.lllIlIlIll += 1
                IIlllIlI.lllIllIlIl += 1
                IIlllIlI.IlllIIIllllII = IIlllIlI.lllIlIlIll / IIlllIlI.lllIllIlIl
            else:
                if lIllIllIIllI.history[-1] == IlllIllllII:
                    IIlllIlI.llllIllllllllIl += 1
                IIlllIlI.IllIIIlI += 1
                IIlllIlI.IIIlIlIIllIIIlI = IIlllIlI.llllIllllllllIl / IIlllIlI.IllIIIlI
        IlIIIIIIlllIlIIIlI = 6.0 * IIlllIlI.IIIlIlIIllIIIlI - 8.0 * IIlllIlI.IlllIIIllllII - 2
        lllllIIlIlIlIIIlIl = 4.0 * IIlllIlI.IIIlIlIIllIIIlI - 5.0 * IIlllIlI.IlllIIIllllII - 1
        if IlIIIIIIlllIlIIIlI >= 0 and IlIIIIIIlllIlIIIlI >= lllllIIlIlIlIIIlIl:
            IlIlIIlII = IlllIllllII
        elif (0 <= IlIIIIIIlllIlIIIlI < lllllIIlIlIlIIIlIl) or (lllllIIlIlIlIIIlIl >= 0):
            IlIlIIlII = IIlllIlI.history[-1].flip()
        else:
            IlIlIIlII = lIlIlIIlllIIIlIIllI
        return IlIlIIlII