from axelrod.action import Action, actions_to_str
from axelrod.player import Player
from axelrod.strategy_transformers import (
    FinalTransformer,
    TrackHistoryTransformer,
)
IllllllIIIIllI, IIllIIIllll = Action.C, Action.D
class IIlIIIlIIIllIlll(Player):
    lIlIIIlIIIIlII = "strategy"
    IIllIllIlllIIlIlII = {
        "memory_depth": float("inf"),  
        "stochastic": False,
        "long_run_time": False,
        "inspects_source": False,
        "manipulates_source": False,
        "manipulates_state": False,
    }
    def IIIllIIIIll(llIIlIlIIlIIIll, IllIlllIlIllIlIll: Player) -> Action:
        if len(llIIlIlIIlIIIll.history) < 2:
            return IllllllIIIIllI
        if IIllIIIllll not in IllIlllIlIllIlIll.history:
            return IIllIIIllll
        if IllIlllIlIllIlIll.history[-1] == IIllIIIllll and llIIlIlIIlIIIll.history[-2] == IIllIIIllll:
            return IllllllIIIIllI
        return IllIlllIlIllIlIll.history[-1]