from axelrod.action import Action, actions_to_str
from axelrod.player import Player
from axelrod.strategy_transformers import (
    FinalTransformer,
    TrackHistoryTransformer,
)
lIllllIlI, IIIlllIIIl = Action.C, Action.D
class lIIllIlIlIIll(Player):
    IIIllIIllIlllll = "strategy"
    lIIlllIIlllIIIlIlIl = {
        "memory_depth": float("inf"),
        "stochastic": False,
        "long_run_time": False,
        "inspects_source": False,
        "manipulates_source": False,
        "manipulates_state": False,
    }
    IllIIIllIIllI = 0.5
    def __init__(IlIllIIlllIIlIllIll, lllIIlIIllII: float = 0.5) -> None:
        super().__init__()
        IlIllIIlllIIlIllIll.lllIIlIIllII = lllIIlIIllII
        IlIllIIlllIIlIllIll.IllIIIllIIllI = lllIIlIIllII
    def IllllIIIIlIlIlIll(IlIllIIlllIIlIllIll, IlIIIIllIIIIIlllI: Player) -> Action:
        if len(IlIIIIllIIIIIlllI.history) == 0:
            return lIllllIlI
        if IlIIIIllIIIIIlllI.history[-1] == lIllllIlI:
            IlIllIIlllIIlIllIll.IllIIIllIIllI += IlIllIIlllIIlIllIll.lllIIlIIllII * (1.0 - IlIllIIlllIIlIllIll.IllIIIllIIllI)
        else:
            IlIllIIlllIIlIllIll.IllIIIllIIllI -= IlIllIIlllIIlIllIll.lllIIlIIllII * IlIllIIlllIIlIllIll.IllIIIllIIllI
        if IlIllIIlllIIlIllIll.IllIIIllIIllI >= 0.5:
            return lIllllIlI
        return IIIlllIIIl