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
llllIIIll, IIlIlIlIIIIII = Action.C, Action.D
class IlIlIlllIllIlI(Player):
    IllllllI = "strategy"
    IIIIIIIlIlIlIlllIIl = {
        "memory_depth": float("inf"),
        "stochastic": True,
        "long_run_time": False,
        "inspects_source": False,
        "manipulates_source": False,
        "manipulates_state": False,
    }
    def __init__(IIlIIlIIlllllllIl) -> None:
        super().__init__()
        IIlIIlIIlllllllIl.IllIllIl = {llllIIIll: 0, IIlIlIlIIIIII: 1}
        IIlIIlIIlllllllIl.IlIIIIlIlIIllI = {llllIIIll: 0, IIlIlIlIIIIII: 1}
        IIlIIlIIlllllllIl.lIIllIIIIlIlIII = False
    def llIllIII(IIlIIlIIlllllllIl, llIlIllll: Player) -> Action:
        lIlIIIIlIlIIlIIlIIll = len(IIlIIlIIlllllllIl.history) + 1
        IlIlIIIlIIllIIllIII = llllIIIll if lIlIIIIlIlIIlIIlIIll <= 2 else IIlIIlIIlllllllIl.history[-2]
        if lIlIIIIlIlIIlIIlIIll > 1:
            IIlIIlIIlllllllIl.IlIIIIlIlIIllI[IlIlIIIlIIllIIllIII] += 1
        if lIlIIIIlIlIIlIIlIIll > 1 and llIlIllll.history[-1] == llllIIIll:
            IIlIIlIIlllllllIl.IllIllIl[IlIlIIIlIIllIIllIII] += 1
        if lIlIIIIlIlIIlIIlIIll <= 4:
            return llllIIIll
        if llIlIllll.history[-1] == IIlIlIlIIIIII and not IIlIIlIIlllllllIl.lIIllIIIIlIlIII:
            IIlIIlIIlllllllIl.lIIllIIIIlIlIII = True
            return llllIIIll
        llIIIIllllll = (
            IIlIIlIIlllllllIl.IllIllIl[IlIlIIIlIIllIIllIII]
            / IIlIIlIIlllllllIl.IlIIIIlIlIIllI[IlIlIIIlIIllIIllIII]
        )
        return IIlIIlIIlllllllIl._random.random_choice(llIIIIllllll)