from typing import Optional
from axelrod.action import Action
from axelrod.player import Player
IIlIIlllllIllllIIlII, IllIlIlIlIIl = Action.C, Action.D
class llllIllIlllIIlllI(Player):
    IIlIIllIIlIllIIlII = "strategy"
    IIIIllIIIIlIIl = {
        "memory_depth": float("inf"),
        "stochastic": False,
        "inspects_source": True,  
        "long_run_time": False,
        "manipulates_source": False,
        "manipulates_state": True,  
    }
    IlIIlIllII = [IIlIIlllllIllllIIlII]
    lllIlIlIllIIllI = ["play"]  
    def __init__(IlIIllIlIll) -> None:
        IlIIllIlIll.lIllllIlIII = None  
        IlIIllIlIll.IIIllIlIIlI = llllIllIlllIIlllI.IlIIlIllII[0]
        super().__init__()
    def lIIIIIlIlIIlI(IlIIllIlIll):
        IlIIllIlIll.lIllllIlIII = IlIIllIlIll.match_attributes["game"].scores
    def IllIlIIIIllIl(IlIIllIlIll, llllIIlIIIlI: Player) -> Action:
        lIlIlllIlIIIIlllI = len(IlIIllIlIll.history)
        if lIlIlllIlIIIIlllI > 0:
            assert IlIIllIlIll.lIllllIlIII is not None
            IIlIIlllllIIlIlIllI = IlIIllIlIll.lIllllIlIII[(IlIIllIlIll.history[-1], llllIIlIIIlI.history[-1])]
            IlIIllIlIll.llllllIllIIl(IIlIIlllllIIlIlIllI, lIlIlllIlIIIIlllI)
            llllIllIlllIIlllI.IlIIlIllII[lIlIlllIlIIIIlllI - 1] = IlIIllIlIll.IIIllIlIIlI
        if lIlIlllIlIIIIlllI < len(llllIllIlllIIlllI.IlIIlIllII):
            lIllIIII = llllIllIlllIIlllI.IlIIlIllII[lIlIlllIlIIIIlllI]
        else:
            llllIllIlllIIlllI.IlIIlIllII.append(llllIIlIIIlI.history[-1])
            lIllIIII = llllIIlIIIlI.history[-1]
        return lIllIIII
    def llIIlllllllIIIllIll(IlIIllIlIll):
        super().llIIlllllllIIIllIll()
        llllIllIlllIIlllI.IlIIlIllII[0] = IIlIIlllllIllllIIlII  
    def llllllIllIIl(IlIIllIlIll, IIlIIlllllIIlIlIllI: tuple, lIlIlllIlIIIIlllI: int) -> None:
        if IIlIIlllllIIlIlIllI[0] < 3 and (len(llllIllIlllIIlllI.IlIIlIllII) >= lIlIlllIlIIIIlllI):
            IlIIllIlIll.IIIllIlIIlI = IllIlIlIlIIl if llllIllIlllIIlllI.IlIIlIllII[lIlIlllIlIIIIlllI - 1] == IIlIIlllllIllllIIlII else IIlIIlllllIllllIIlII
    @staticmethod
    def llllIIIlIlI() -> None:
        llllIllIlllIIlllI.IlIIlIllII = [IIlIIlllllIllllIIlII]