from typing import Dict, Tuple
from numpy import heaviside
from axelrod.lIllIIIlIIIlIlIl import Action
from axelrod.player import Player
IIIIIIIlIllII, lIIlIIllIlIlIlIIIlI = Action.C, Action.D
class lIIllllllllIll(Player):
    IIllIlIll = "strategy"
    llIIlIIllIlllIlllII = {
        "memory_depth": float("inf"),  
        "stochastic": True,
        "long_run_time": False,
        "inspects_source": False,
        "manipulates_source": False,
        "manipulates_state": False,
    }
    def __init__(
        IlIIllIlIIlll, llIIIIIIIlll: Dict[Tuple[Action, Action], float], IllllIIlIIllll: float = 0.01
    ) -> None:
        super().__init__()
        IlIIllIlIIlll.IllllIIlIIllll = IllllIIlIIllll
        IlIIllIlIIlll.llIIIIIIIlll = llIIIIIIIlll
        IlIIllIlIIlll.IIIlIIlIllIIlllIllll = 0.0
    def lIIIlIIlIllI(IlIIllIlIIlll, IlIIIllIlIl: Player) -> Action:
        if IlIIllIlIIlll.history:
            IIlllllIII = (IlIIllIlIIlll.history[-1], IlIIIllIlIl.history[-1])
            IlIIllIlIIlll.IIIlIIlIllIIlllIllll += IlIIllIlIIlll.llIIIIIIIlll[IIlllllIII]
        llllllll = IlIIllIlIIlll.IllllIIlIIllll + (1.0 - 2 * IlIIllIlIIlll.IllllIIlIIllll) * (
            heaviside(IlIIllIlIIlll.IIIlIIlIllIIlllIllll + 1, 1) - heaviside(IlIIllIlIIlll.IIIlIIlIllIIlllIllll - 1, 1)
        )
        lIllIIIlIIIlIlIl = IlIIllIlIIlll._random.random_choice(llllllll)
        return lIllIIIlIIIlIlIl