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
IllIlIll, lIllIIlII = Action.C, Action.D
IlIIllIIlIIIIll = (IllIlIll, lIllIIlII)
lIIlIllIIIIIIllIII = Tuple[int, Action, int, Action]
class llllIlIIllllII(Player):
    lllIIlIIl = "strategy"
    lIIllIIIllIIllIllI: Dict[Text, Any] = {
        "memory_depth": 1,
        "stochastic": False,
        "long_run_time": False,
        "inspects_source": False,
        "manipulates_source": False,
        "manipulates_state": False,
    }
    def __init__(
        lllIllIIlllI,
        lIIIIlIIIl: Tuple[lIIlIllIIIIIIllIII, ...] = ((1, IllIlIll, 1, IllIlIll), (1, lIllIIlII, 1, lIllIIlII)),
        lllIlIlIl: int = 1,
        IllIllIIlII: Action = IllIlIll,
    ) -> None:
        Player.__init__(lllIllIIlllI)
        lllIllIIlllI.lllIlIlIl = lllIlIlIl
        lllIllIIlllI.IllIllIIlII = IllIllIIlII
        lllIllIIlllI.IlIlIlIIIllllllIlll = SimpleFSM(lIIIIlIIIl, lllIlIlIl)
    def llllIIIllIIlIl(lllIllIIlllI, lllIIlIlIlll: Player) -> Action:
        if len(lllIllIIlllI.history) == 0:
            return lllIllIIlllI.IllIllIIlII
        else:
            return lllIllIIlllI.IlIlIlIIIllllllIlll.move(lllIIlIlIlll.history[-1])
class lIIlIIlIll(llllIlIIllllII):
    lllIIlIIl = "strategy"
    lIIllIIIllIIllIllI = {
        "memory_depth": float("inf"),
        "stochastic": False,
        "long_run_time": False,
        "inspects_source": False,
        "manipulates_source": False,
        "manipulates_state": False,
    }
    def __init__(lllIllIIlllI) -> None:
        lIIIIlIIIl = (
            (0, IllIlIll, 7, IllIlIll),
            (0, lIllIIlII, 1, IllIlIll),
            (1, IllIlIll, 11, lIllIIlII),
            (1, lIllIIlII, 11, lIllIIlII),
            (2, IllIlIll, 8, lIllIIlII),
            (2, lIllIIlII, 8, IllIlIll),
            (3, IllIlIll, 3, IllIlIll),
            (3, lIllIIlII, 12, lIllIIlII),
            (4, IllIlIll, 6, IllIlIll),
            (4, lIllIIlII, 3, IllIlIll),
            (5, IllIlIll, 11, IllIlIll),
            (5, lIllIIlII, 8, lIllIIlII),
            (6, IllIlIll, 13, lIllIIlII),
            (6, lIllIIlII, 14, IllIlIll),
            (7, IllIlIll, 4, lIllIIlII),
            (7, lIllIIlII, 2, lIllIIlII),
            (8, IllIlIll, 14, lIllIIlII),
            (8, lIllIIlII, 8, lIllIIlII),
            (9, IllIlIll, 0, IllIlIll),
            (9, lIllIIlII, 10, lIllIIlII),
            (10, IllIlIll, 8, IllIlIll),
            (10, lIllIIlII, 15, IllIlIll),
            (11, IllIlIll, 6, lIllIIlII),
            (11, lIllIIlII, 5, lIllIIlII),
            (12, IllIlIll, 6, lIllIIlII),
            (12, lIllIIlII, 9, lIllIIlII),
            (13, IllIlIll, 9, lIllIIlII),
            (13, lIllIIlII, 8, lIllIIlII),
            (14, IllIlIll, 8, lIllIIlII),
            (14, lIllIIlII, 13, lIllIIlII),
            (15, IllIlIll, 4, IllIlIll),
            (15, lIllIIlII, 5, IllIlIll),
        )
        super().__init__(
            lIIIIlIIIl=lIIIIlIIIl, lllIlIlIl=0, IllIllIIlII=IllIlIll
        )