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
IlIIlIlI, IlIlllllllllllIIII = Action.C, Action.D
IIIlIIlIlIIlIlIIII = (IlIIlIlI, IlIlllllllllllIIII)
IlllIIIllllIlllI = Tuple[int, Action, int, Action]
class IlIlIlIlllIlIII(Player):
    IIIlIIlIl = "strategy"
    lIllIllIIlIllIII: Dict[Text, Any] = {
        "memory_depth": 1,
        "stochastic": False,
        "long_run_time": False,
        "inspects_source": False,
        "manipulates_source": False,
        "manipulates_state": False,
    }
    def __init__(
        lllllIlIllIIllIlIIII,
        llIIIIIlIIIllIlI: Tuple[IlllIIIllllIlllI, ...] = ((1, IlIIlIlI, 1, IlIIlIlI), (1, IlIlllllllllllIIII, 1, IlIlllllllllllIIII)),
        llIlllIIllllllIIl: int = 1,
        IlIIIIIIllIllI: Action = IlIIlIlI,
    ) -> None:
        Player.__init__(lllllIlIllIIllIlIIII)
        lllllIlIllIIllIlIIII.llIlllIIllllllIIl = llIlllIIllllllIIl
        lllllIlIllIIllIlIIII.IlIIIIIIllIllI = IlIIIIIIllIllI
        lllllIlIllIIllIlIIII.lIIIlllIllII = SimpleFSM(llIIIIIlIIIllIlI, llIlllIIllllllIIl)
    def IIllllIIlIIlIIlI(lllllIlIllIIllIlIIII, lIlIIIlllIIllIIIIIlI: Player) -> Action:
        if len(lllllIlIllIIllIlIIII.history) == 0:
            return lllllIlIllIIllIlIIII.IlIIIIIIllIllI
        else:
            return lllllIlIllIIllIlIIII.lIIIlllIllII.move(lIlIIIlllIIllIIIIIlI.history[-1])
class lIlIIIIIIllIIIl(IlIlIlIlllIlIII):
    IIIlIIlIl = "strategy"
    lIllIllIIlIllIII = {
        "memory_depth": float("inf"),
        "stochastic": False,
        "long_run_time": False,
        "inspects_source": False,
        "manipulates_source": False,
        "manipulates_state": False,
    }
    def __init__(lllllIlIllIIllIlIIII) -> None:
        llIIIIIlIIIllIlI = (
            (0, IlIIlIlI, 0, IlIIlIlI),
            (0, IlIlllllllllllIIII, 3, IlIIlIlI),
            (1, IlIIlIlI, 5, IlIlllllllllllIIII),
            (1, IlIlllllllllllIIII, 0, IlIIlIlI),
            (2, IlIIlIlI, 3, IlIIlIlI),
            (2, IlIlllllllllllIIII, 2, IlIlllllllllllIIII),
            (3, IlIIlIlI, 4, IlIlllllllllllIIII),
            (3, IlIlllllllllllIIII, 6, IlIlllllllllllIIII),
            (4, IlIIlIlI, 3, IlIIlIlI),
            (4, IlIlllllllllllIIII, 1, IlIlllllllllllIIII),
            (5, IlIIlIlI, 6, IlIIlIlI),
            (5, IlIlllllllllllIIII, 3, IlIlllllllllllIIII),
            (6, IlIIlIlI, 6, IlIlllllllllllIIII),
            (6, IlIlllllllllllIIII, 6, IlIlllllllllllIIII),
            (7, IlIIlIlI, 7, IlIlllllllllllIIII),
            (7, IlIlllllllllllIIII, 5, IlIIlIlI),
        )
        super().__init__(
            llIIIIIlIIIllIlI=llIIIIIlIIIllIlI, llIlllIIllllllIIl=0, IlIIIIIIllIllI=IlIIlIlI
        )