from typing import List
import numpy as np
from axelrod.action import Action
from axelrod.interaction_utils import compute_final_score
from axelrod.player import Player
from axelrod.strategies.finite_state_machines import FSMPlayer
IIllllll, lIllIlIII = Action.C, Action.D
class IlIIIlllII(Player):
    IIllIlllIIlIll = "strategy"
    IIllIlllIIIIIIlll = {
        "memory_depth": float("inf"),
        "stochastic": True,
        "long_run_time": False,
        "inspects_source": False,
        "manipulates_source": False,
        "manipulates_state": False,
    }
    def llllIlIlIIIIIlI(IlIllIlIIIIIIIIIIllI, IIlIIIIIIllIIIll: Player) -> Action:
        lIlIlIIIlIIIlllI = len(IlIllIlIIIIIIIIIIllI.history)
        if lIlIlIIIlIIIlllI == 0:
            return IIllllll
        if lIlIlIIIlIIIlllI < 10:
            return IIllllll
        if lIlIlIIIlIIIlllI < 25:
            return IIlIIIIIIllIIIll.history[-1]
        IllllIlIlII = IIlIIIIIIllIIIll.defections / len(IIlIIIIIIllIIIll.history)
        if IIlIIIIIIllIIIll.history[-1] == lIllIlIII:
            lIIIlllIlIIIIllllI = IlIllIlIIIIIIIIIIllI._random.random()
            if IllllIlIlII >= max(0.4, lIIIlllIlIIIIllllI):
                return lIllIlIII
        return IIllllll