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
IIlllIlllIIIIlII, IIIllIII = Action.C, Action.D
class IlllIlllIIlI(Player):
    IIIlllllIIIIIl = "strategy"
    llIIlIIIIl = {
        "memory_depth": float("inf"),
        "stochastic": True,
        "long_run_time": False,
        "inspects_source": False,
        "manipulates_source": False,
        "manipulates_state": False,
    }
    def lIlllIlll(IlllIlllll, IlllIlIllIlIlIl: Player) -> Action:
        lIIIlIII = len(IlllIlllll.history) + 1
        if lIIIlIII == 1:
            return IIlllIlllIIIIlII
        lllIIlll = IlllIlIllIlIlIl.defections
        IlIllIII = lllIIlll / lIIIlIII
        if lIIIlIII > 39 and IlIllIII > 0.39:
            return IIIllIII
        if lIIIlIII > 29 and IlIllIII > 0.65:
            return IIIllIII
        if lIIIlIII > 19 and IlIllIII > 0.79:
            return IIIllIII
        if IlllIlIllIlIlIl.history[-1] == IIIllIII:
            if lllIIlll > 17:
                return IIIllIII
            else:
                return IlllIlllll._random.random_choice(0.5)
        else:
            return IIlllIlllIIIIlII