import itertools
from typing import Any, Dict, List, Optional, Sequence, Text, Tuple
from axelrod.action import Action
from axelrod.evolvable_player import (
    EvolvablePlayer,
    InsufficientParametersError,
    copy_lists,
)
from axelrod.player import Player
lIllIllIll, llllIIlllIIl = Action.C, Action.D
lIlIllllllIllIlllI = (lIllIllIll, llllIIlllIIl)
lllllIIIIlllllllIl = Tuple[int, Action, int, Action]
class IIlIIIlllII(Player):
    lllIIlII = "strategy"
    IlllIlIlll: Dict[Text, Any] = {
        "memory_depth": 1,
        "stochastic": False,
        "long_run_time": False,
        "inspects_source": False,
        "manipulates_source": False,
        "manipulates_state": False,
    }
    def __init__(
        IIlIIIIlIllll,
        IIllllIlIIllIlllllll: Tuple[lllllIIIIlllllllIl, ...] = ((1, lIllIllIll, 1, lIllIllIll), (1, llllIIlllIIl, 1, llllIIlllIIl)),
        IIIlIlIIlllIllllIl: int = 1,
        lIIIlllllIlIllIlIll: Action = lIllIllIll,
    ) -> None:
        Player.__init__(IIlIIIIlIllll)
        IIlIIIIlIllll.IIIlIlIIlllIllllIl = IIIlIlIIlllIllllIl
        IIlIIIIlIllll.lIIIlllllIlIllIlIll = lIIIlllllIlIllIlIll
        IIlIIIIlIllll.llIlIIlII = SimpleFSM(IIllllIlIIllIlllllll, IIIlIlIIlllIllllIl)
    def IIllllIIIIlllIllI(IIlIIIIlIllll, IllllIIlllIl: Player) -> Action:
        if len(IIlIIIIlIllll.history) == 0:
            return IIlIIIIlIllll.lIIIlllllIlIllIlIll
        else:
            return IIlIIIIlIllll.llIlIIlII.move(IllllIIlllIl.history[-1])
class llIllIllIllIIIIIIIl(IIlIIIlllII):
    lllIIlII = "strategy"
    IlllIlIlll = {
        "memory_depth": 3,
        "stochastic": False,
        "long_run_time": False,
        "inspects_source": False,
        "manipulates_source": False,
        "manipulates_state": False,
    }
    def __init__(IIlIIIIlIllll) -> None:
        IIllllIlIIllIlllllll = (
            (1, lIllIllIll, 1, llllIIlllIIl),
            (1, llllIIlllIIl, 2, llllIIlllIIl),
            (2, lIllIllIll, 1, llllIIlllIIl),
            (2, llllIIlllIIl, 3, llllIIlllIIl),
            (3, lIllIllIll, 1, llllIIlllIIl),
            (3, llllIIlllIIl, 4, lIllIllIll),
            (4, lIllIllIll, 4, lIllIllIll),
            (4, llllIIlllIIl, 1, llllIIlllIIl),
        )
        super().__init__(
            IIllllIlIIllIlllllll=IIllllIlIIllIlllllll, IIIlIlIIlllIllllIl=1, lIIIlllllIlIllIlIll=llllIIlllIIl
        )