code "class main: def __init__(self): self.pos = 'A' def solve(self, dct): if self.pos in dct: ret = dct[self.pos][1] self.pos = dct[self.pos][0] return ret raise KeyError def shift(self): return self.solve({'A': ['A', 2], 'D': ['E', 5], 'G': ['C', 10]}) def exit(self): return self.solve({'A': ['B', 0], 'C': ['D', 4], 'E': ['F', 6], 'F': ['G', 7], 'G': ['G', 11]}) def snap(self): return self.solve({'A': ['D', 1], 'B': ['C', 3], 'F': ['B', 8], 'G': ['H', 9]})" "class main: def __init__(self): self.pos = 'A' def solve(self, dct): if self.pos in dct: ret = dct[self.pos][1] self.pos = dct[self.pos][0] return ret raise KeyError def shift(self): return self.solve({'A': ['A', 2], 'D': ['E', 5], 'G': ['C', 10]}) def exit(self): return self.solve({'A': ['B', 0], 'C': ['D', 4], 'E': ['F', 6], 'F': ['G', 7], 'G': ['G', 11]}) def snap(self): return self.solve({'A': ['D', 1], 'B': ['C', 3], 'F': ['B', 8], 'G': ['H', 9]})" "class main: def __init__(self): self.pos = 'A' def solve(self, dct): if self.pos in dct: ret = dct[self.pos][1] self.pos = dct[self.pos][0] return ret raise KeyError def shift(self): return self.solve({'A': ['A', 2], 'D': ['E', 5], 'G': ['C', 10]}) def exit(self): return self.solve({'A': ['B', 0], 'C': ['D', 4], 'E': ['F', 6], 'F': ['G', 7], 'G': ['G', 11]}) def snap(self): return self.solve({'A': ['D', 1], 'B': ['C', 3], 'F': ['B', 8], 'G': ['H', 9]})" "class main: def __init__(self): self.pos = 'A' def solve(self, dct): if self.pos in dct: ret = dct[self.pos][1] self.pos = dct[self.pos][0] return ret raise KeyError def shift(self): return self.solve({'A': ['A', 2], 'D': ['E', 5], 'G': ['C', 10]}) def exit(self): return self.solve({'A': ['B', 0], 'C': ['D', 4], 'E': ['F', 6], 'F': ['G', 7], 'G': ['G', 11]}) def snap(self): return self.solve({'A': ['D', 1], 'B': ['C', 3], 'F': ['B', 8], 'G': ['H', 9]})" "class main: def __init__(self): self.pos = 'A' def solve(self, dct): if self.pos in dct: ret = dct[self.pos][1] self.pos = dct[self.pos][0] return ret raise KeyError def shift(self): return self.solve({'A': ['A', 2], 'D': ['E', 5], 'G': ['C', 10]}) def exit(self): return self.solve({'A': ['B', 0], 'C': ['D', 4], 'E': ['F', 6], 'F': ['G', 7], 'G': ['G', 11]}) def snap(self): return self.solve({'A': ['D', 1], 'B': ['C', 3], 'F': ['B', 8], 'G': ['H', 9]})" "class main: def __init__(self): self.pos = 'A' def solve(self, dct): if self.pos in dct: ret = dct[self.pos][1] self.pos = dct[self.pos][0] return ret raise KeyError def shift(self): return self.solve({'A': ['A', 2], 'D': ['E', 5], 'G': ['C', 10]}) def exit(self): return self.solve({'A': ['B', 0], 'C': ['D', 4], 'E': ['F', 6], 'F': ['G', 7], 'G': ['G', 11]}) def snap(self): return self.solve({'A': ['D', 1], 'B': ['C', 3], 'F': ['B', 8], 'G': ['H', 9]})" "class main: def __init__(self): self.state = 'A' self.graph = {('A', 'spawn'): ('B', 0), ('A', 'post'): ('C', 1), ('B', 'leer'): ('C', 2), ('B', 'spawn'): ('D', 3), ('C', 'spawn'): ('F', 5), ('C', 'post'): ('D', 4), ('C', 'leer'): ('E', 6), ('D', 'leer'): ('E', 7), ('E', 'post'): ('F', 8)} def set_state(self, state, number): self.state = state return number def change_state(self, func_name): (state, number) = self.graph[self.state, func_name] self.state = state return number def leer(self): return self.change_state('leer') def post(self): return self.change_state('post') def spawn(self): return self.change_state('spawn')" "class main: def __init__(self): self.state = 'A' self.graph = {('A', 'spawn'): ('B', 0), ('A', 'post'): ('C', 1), ('B', 'leer'): ('C', 2), ('B', 'spawn'): ('D', 3), ('C', 'spawn'): ('F', 5), ('C', 'post'): ('D', 4), ('C', 'leer'): ('E', 6), ('D', 'leer'): ('E', 7), ('E', 'post'): ('F', 8)} def set_state(self, state, number): self.state = state return number def change_state(self, func_name): (state, number) = self.graph[self.state, func_name] self.state = state return number def leer(self): return self.change_state('leer') def post(self): return self.change_state('post') def spawn(self): return self.change_state('spawn')" "class main: def __init__(self): self.state = 'A' def fetch(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 2 elif self.state == 'E': self.state = 'E' return 6 elif self.state == 'F': self.state = 'F' return 8 else: raise KeyError def race(self): if self.state == 'C': self.state = 'D' return 3 elif self.state == 'D': self.state = 'E' return 4 elif self.state == 'E': self.state = 'F' return 5 elif self.state == 'F': self.state = 'G' return 7 else: raise KeyError def mask(self): if self.state == 'A': self.state = 'C' return 1 elif self.state == 'F': self.state = 'C' return 9 else: raise KeyError" "class main: def __init__(self): self.state = 'A' self.graph = {('A', 'spawn'): ('B', 0), ('A', 'post'): ('C', 1), ('B', 'leer'): ('C', 2), ('B', 'spawn'): ('D', 3), ('C', 'spawn'): ('F', 5), ('C', 'post'): ('D', 4), ('C', 'leer'): ('E', 6), ('D', 'leer'): ('E', 7), ('E', 'post'): ('F', 8)} def set_state(self, state, number): self.state = state return number def change_state(self, func_name): (state, number) = self.graph[self.state, func_name] self.state = state return number def leer(self): return self.change_state('leer') def post(self): return self.change_state('post') def spawn(self): return self.change_state('spawn')" "class Govno: def __init__(self): self.pos = 'A' self.g = None def __str__(self): return self.g def bend(self): if self.pos == 'A': self.g = 0 self.pos = 'B' return 0 if self.pos == 'B': self.g = 1 self.pos = 'C' return 1 if self.pos == 'C': self.g = 4 self.pos = 'D' return self.g if self.pos == 'E': self.g = 7 self.pos = 'A' return 7 raise KeyError def begin(self): if self.pos == 'B': self.g = 2 return 2 if self.pos == 'D': self.g = 5 self.pos = 'E' return 5 if self.pos == 'E': self.g = 6 self.pos = 'F' return 6 raise KeyError def hurry(self): if self.pos == 'B': self.g = 3 self.pos = 'E' return 3 if self.pos == 'F': self.g = 8 self.pos = 'D' return 8 raise KeyError def main(): return Govno()" "class MillyMachine: def __init__(self): self.status = 'A' def begin(self): if self.status == 'A': self.status = 'B' return 0 if self.status == 'B': self.status = 'C' return 2 if self.status == 'C': self.status = 'D' return 3 if self.status == 'D': self.status = 'E' return 4 if self.status == 'E': self.status = 'F' return 5 if self.status == 'F': self.status = 'D' return 7 raise KeyError def peek(self): if self.status == 'A': self.status = 'C' return 1 if self.status == 'F': self.status = 'F' return 8 if self.status == 'E': self.status = 'A' return 6 raise KeyError def main() -> MillyMachine(): return MillyMachine()" "class Mealy: def __init__(self): self.state = 3 self.states = {0: {'s': 1}, 1: {'a': 2, 's': 3}, 2: {'a': 5, 's': 4}, 3: {'s': 0}, 4: {'s': 6}, 5: {'s': 7}, 6: {'s': 7}, 7: {'a': 9, 's': 8}, 8: {'s': 3, 'a': 2}, 9: {'s': 6}} def scan(self): self.state = self.states[self.state]['s'] return self.state def apply(self): self.state = self.states[self.state]['a'] return self.state def main(): return Mealy()" "class main: def __init__(self): start_state = 'A' states = {'A': {'slip': [0, 'B']}, 'B': {'start': [1, 'C'], 'spawn': [2, 'E']}, 'C': {'start': [3, 'D']}, 'D': {'start': [4, 'E'], 'slip': [5, 'H'], 'roam': [6, 'F'], 'spawn': [7, 'B']}, 'E': {'slip': [8, 'F']}, 'F': {'spawn': [9, 'G'], 'start': [10, 'A']}, 'G': {'slip': [11, 'H']}, 'H': {}} self.state = start_state self.states = states def __getattr__(self, attr): if attr not in self.states[self.state].keys(): raise KeyError self.result = self.states[self.state][attr][0] self.state = self.states[self.state][attr][1] return self.res def res(self): return self.result" "class main: def __init__(self): self.pos = 'A' def solve(self, dct): if self.pos in dct: ret = dct[self.pos][1] self.pos = dct[self.pos][0] return ret raise KeyError def shift(self): return self.solve({'A': ['A', 2], 'D': ['E', 5], 'G': ['C', 10]}) def exit(self): return self.solve({'A': ['B', 0], 'C': ['D', 4], 'E': ['F', 6], 'F': ['G', 7], 'G': ['G', 11]}) def snap(self): return self.solve({'A': ['D', 1], 'B': ['C', 3], 'F': ['B', 8], 'G': ['H', 9]})" "class main: def __init__(self): self.__state = 'A' def sweep(self): if self.__state == 'A': self.__state = 'B' return 0 if self.__state == 'B': self.__state = 'C' return 2 if self.__state == 'E': self.__state = 'F' return 7 raise KeyError def drag(self): if self.__state == 'B': return 3 if self.__state == 'F': return 8 raise KeyError def make(self): if self.__state == 'A': self.__state = 'E' return 1 if self.__state == 'B': self.__state = 'F' return 4 if self.__state == 'C': self.__state = 'D' return 5 if self.__state == 'D': self.__state = 'E' return 6 raise KeyError" "class MiliMachine: def __init__(self): self.state = 'A' def coat(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'D': self.state = 'E' return 6 else: raise KeyError def open(self): if self.state == 'B': return 4 elif self.state == 'D': self.state = 'B' return 7 elif self.state == 'A': self.state = 'G' return 1 elif self.state == 'F': self.state = 'G' return 9 else: raise KeyError def link(self): if self.state == 'B': self.state = 'C' return 3 elif self.state == 'C': self.state = 'D' return 5 elif self.state == 'A': self.state = 'E' return 2 elif self.state == 'E': self.state = 'F' return 8 else: raise KeyError def main(): return MiliMachine()" "class main: def __init__(self): self.state = 'A' def forge(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'F' return 3 elif self.state == 'D': self.state = 'E' return 6 elif self.state == 'E': self.state = 'F' return 7 else: raise KeyError def unite(self): if self.state == 'B': self.state = 'C' return 2 elif self.state == 'C': self.state = 'D' return 5 else: raise KeyError def coat(self): if self.state == 'B': self.state = 'E' return 4 elif self.state == 'E': self.state = 'A' return 8 elif self.state == 'A': self.state = 'F' return 1 else: raise KeyError" "class main: def __init__(self): self.state = 'A' def debug(self): if self.state == 'A': self.state = 'D' return 1 elif self.state == 'E': self.state = 'F' return 7 elif self.state == 'B': self.state = 'G' return 4 else: raise KeyError def chat(self): if self.state == 'A': self.state = 'B' return 0 else: raise KeyError def carve(self): if self.state == 'A': self.state = 'F' return 2 elif self.state == 'B': self.state = 'C' return 3 elif self.state == 'C': self.state = 'D' return 5 elif self.state == 'D': self.state = 'E' return 6 elif self.state == 'E': self.state = 'A' return 8 elif self.state == 'F': self.state = 'G' return 9 else: raise KeyError" "class main: stat = 'A' def apply(self): match self.stat: case 'A': return 1 case 'B': self.stat = 'C' return 2 case 'C': raise KeyError case 'D': self.stat = 'A' return 5 case 'E': self.stat = 'A' return 7 case 'F': raise KeyError def sway(self): match self.stat: case 'A': self.stat = 'B' return 0 case 'B': raise KeyError case 'C': self.stat = 'D' return 3 case 'D': self.stat = 'E' return 4 case 'E': self.stat = 'F' return 6 case 'F': self.stat = 'D' return 8" "from abc import ABC, abstractmethod class P(ABC): @abstractmethod def cast(self, current) -> int: pass @abstractmethod def trash(self, current) -> int: pass @abstractmethod def reset(self, current) -> int: pass class A(P): def cast(self, current) -> int: current.current = B() return 0 def trash(self, current) -> int: current.current = C() return 1 def reset(self, current) -> int: current.current = F() return 2 class B(P): def cast(self, current) -> int: raise KeyError() def trash(self, current) -> int: raise KeyError() def reset(self, current) -> int: current.current = C() return 3 class C(P): def cast(self, current) -> int: raise KeyError() def trash(self, current) -> int: raise KeyError() def reset(self, current) -> int: current.current = D() return 4 class D(P): def cast(self, current) -> int: raise KeyError() def trash(self, current) -> int: raise KeyError() def reset(self, current) -> int: current.current = E() return 5 class E(P): def cast(self, current) -> int: current.current = F() return 6 def trash(self, current) -> int: current.current = G() return 7 def reset(self, current) -> int: raise KeyError() class F(P): def cast(self, current) -> int: raise KeyError() def trash(self, current) -> int: current.current = G() return 8 def reset(self, current) -> int: current.current = F() return 9 class G(P): def cast(self, current) -> int: pass def trash(self, current) -> int: pass def reset(self, current) -> int: pass class FiniteStateMachine: def __init__(self) -> None: self.current = A() def cast(self) -> int: return self.current.cast(self) def trash(self) -> int: return self.current.trash(self) def reset(self) -> int: return self.current.reset(self) def main() -> FiniteStateMachine: return FiniteStateMachine()" "from enum import Enum, auto class State(Enum): A = auto() B = auto() C = auto() D = auto() E = auto() F = auto() G = auto() H = auto() def main(): return Main() class Main: def __init__(self) -> None: self.state = State.A def close(self): match self.state: case State.A: self.state = State.B return 0 case State.B: self.state = State.C return 1 case State.C: self.state = State.A return 3 case State.D: self.state = State.B return 5 case State.E: self.state = State.C return 7 case State.F: self.state = State.H return 9 case State.G: raise KeyError() case State.H: raise KeyError() def blame(self): match self.state: case State.A: raise KeyError() case State.B: raise KeyError() case State.C: self.state = State.D return 2 case State.D: self.state = State.E return 4 case State.E: self.state = State.F return 6 case State.F: self.state = State.G return 8 case State.G: self.state = State.H return 10 case State.H: raise KeyError() def herd(self): match self.state: case State.H: self.state = State.A return 11 case _: raise KeyError()" "dashm = (0, 3, 4, 7, 8, 11) swapm = (1, 10) paintm = (2, 5) etchm = (6, 9) arr = {-1: [0, 1, 2], 0: [3], 1: [8], 2: [7], 3: [4, 5], 4: [6], 5: [-2], 6: [7], 7: [8], 8: [11, 9, 10], 9: [-2], 10: [6], 11: [11, 10, 9]} class mymain: def __init__(self): self.n = -1 def dash(self): for i in arr.get(self.n): if i in dashm: self.n = i return i raise KeyError def swap(self): for i in arr.get(self.n): if i in swapm: self.n = i return i raise KeyError def paint(self): for i in arr.get(self.n): if i in paintm: self.n = i return i raise KeyError def etch(self): for i in arr.get(self.n): if i in etchm: self.n = i return i raise KeyError def main(): return mymain()" "from enum import Enum, auto class State(Enum): A = auto() B = auto() C = auto() D = auto() E = auto() F = auto() G = auto() H = auto() def main(): return Main() class Main: def __init__(self) -> None: self.state = State.A def play(self): match self.state: case State.A: self.state = State.B return 0 case State.B: self.state = State.D return 2 case State.C: self.state = State.D return 3 case State.D: self.state = State.A return 6 case State.E: raise KeyError() case State.F: raise KeyError() def carve(self): match self.state: case State.A: raise KeyError() case State.B: self.state = State.C return 1 case State.C: self.state = State.E return 4 case State.D: self.state = State.E return 5 case State.E: self.state = State.F return 7 case State.F: self.state = State.D return 8" "class main: def __init__(self): self.condition = 'A' def fill(self): if self.condition == 'A': self.condition = 'B' return 0 if self.condition == 'B': self.condition = 'C' return 1 if self.condition == 'C': self.condition = 'A' return 3 if self.condition == 'D': self.condition = 'E' return 5 if self.condition == 'G': self.condition = 'H' return 9 if self.condition == 'H': self.condition = 'B' return 11 else: raise KeyError def leer(self): if self.condition == 'C': self.condition = 'E' return 4 if self.condition == 'D': self.condition = 'B' return 6 if self.condition == 'E': self.condition = 'F' return 7 if self.condition == 'F': self.condition = 'G' return 8 if self.condition == 'G': self.condition = 'D' return 10 else: raise KeyError def brake(self): if self.condition == 'C': self.condition = 'D' return 2 else: raise KeyError" "class Mealy: state = 'A' transitions = {'throw': {'A': ('B', 0), 'B': ('C', 1), 'C': ('D', 4)}, 'drive': {'B': ('B', 2), 'D': ('F', 6)}, 'step': {'B': ('E', 3), 'D': ('E', 5), 'E': ('F', 7), 'F': ('G', 8), 'G': ('D', 9)}} def execute(self, input): state = self.state transition = self.transitions[input][state] self.state = transition[0] return transition[1] def throw(self): return self.execute('throw') def drive(self): return self.execute('drive') def step(self): return self.execute('step') def main(): return Mealy()" "import sys class main: def __init__(self): self.curr_state = 'A' self.states = {'A': ['B', 'D'], 'B': ['C', 'G'], 'C': ['H', 'D'], 'D': ['E', 0], 'E': [0, 'F'], 'F': ['G', 0], 'G': ['A', 'H'], 'H': ['F', 0]} self.state_key = {'A': [0, 1], 'B': [2, 3], 'C': [5, 4], 'D': [6, ''], 'E': ['', 7], 'F': [8, ''], 'G': [10, 9], 'H': [11, '']} def scrub(self): if self.states[self.curr_state][0] != 0: last_state = self.curr_state self.curr_state = self.states[self.curr_state][0] return self.state_key[last_state][0] else: raise KeyError() def skid(self): if self.states[self.curr_state][1] != 0: last_state = self.curr_state self.curr_state = self.states[self.curr_state][1] return self.state_key[last_state][1] else: raise KeyError()" "class main: def __init__(self): self.state = 'A' def step(self): if self.state == 'B': self.state = 'C' return 1 if self.state == 'C': self.state = 'A' return 3 if self.state == 'E': self.state = 'G' return 6 if self.state == 'F': self.state = 'A' return 9 raise KeyError def link(self): if self.state == 'A': self.state = 'B' return 0 if self.state == 'E': self.state = 'F' return 5 if self.state == 'F': self.state = 'G' return 8 raise KeyError def turn(self): if self.state == 'C': self.state = 'D' return 2 if self.state == 'D': self.state = 'E' return 4 if self.state == 'E': self.state = 'C' return 7 raise KeyError" "class main: def __init__(self): self.state = 'A' self.path = {'A': [[self.merge, 0, 'B'], [self.tag, 3, 'A'], [self.move, 1, 'F'], [self.stare, 2, 'C']], 'B': [[self.move, 4, 'C']], 'C': [[self.stare, 5, 'D']], 'D': [[self.stare, 6, 'E']], 'E': [[self.merge, 8, 'C'], [self.stare, 7, 'F']]} def tag(self): return self.check(self.tag) def merge(self): return self.check(self.merge) def stare(self): return self.check(self.stare) def move(self): return self.check(self.move) def check(self, func): elem = [function for function in self.path[self.state] if func == function[0]] if len(elem) != 0: self.state = elem[0][2] return elem[0][1] else: raise KeyError" "class main: now_letter = 'A' slov_drive = {'A': '1A', 'D': '6A', 'E': '8A', 'C': '4F'} slov_fetch = {'A': '0B', 'B': '2C', 'C': '3D', 'D': '5E', 'E': '7F'} def drive(self): temp_drive = self.now_letter if self.slov_drive.get(temp_drive, 'KeyError')[1] != 'e': self.now_letter = self.slov_drive.get(temp_drive, 'KeyError')[1] return int(self.slov_drive.get(temp_drive)[0]) else: raise KeyError def fetch(self): temp_fetch = self.now_letter if self.slov_fetch.get(temp_fetch, 'KeyError')[1] != 'e': self.now_letter = self.slov_fetch.get(temp_fetch, 'KeyError')[1] return int(self.slov_fetch.get(temp_fetch)[0]) else: raise KeyError" "class main: def __init__(self): self.__state = 'A' def herd(self): if self.__state == 'A': self.__state = 'B' return 0 if self.__state == 'E': return 8 if self.__state == 'D': self.__state = 'F' return 5 raise KeyError def warp(self): if self.__state == 'C': self.__state = 'D' return 3 if self.__state == 'D': self.__state = 'E' return 4 if self.__state == 'F': self.__state = 'G' return 9 if self.__state == 'G': self.__state = 'H' return 10 raise KeyError def place(self): if self.__state == 'A': self.__state = 'F' return 1 if self.__state == 'B': self.__state = 'C' return 2 if self.__state == 'D': self.__state = 'G' return 6 if self.__state == 'E': self.__state = 'F' return 7 if self.__state == 'H': self.__state = 'A' return 11 raise KeyError" "from pickletools import pyint states = [{'st': 'A', 'nst': 'B', 'cond': 'crash', 'out': 0}, {'st': 'B', 'nst': 'C', 'cond': 'crash', 'out': 1}, {'st': 'B', 'nst': 'G', 'cond': 'close', 'out': 2}, {'st': 'C', 'nst': 'D', 'cond': 'crash', 'out': 3}, {'st': 'C', 'nst': 'F', 'cond': 'drag', 'out': 4}, {'st': 'C', 'nst': 'G', 'cond': 'close', 'out': 5}, {'st': 'D', 'nst': 'E', 'cond': 'crash', 'out': 6}, {'st': 'E', 'nst': 'F', 'cond': 'crash', 'out': 7}, {'st': 'E', 'nst': 'E', 'cond': 'close', 'out': 8}, {'st': 'F', 'nst': 'G', 'cond': 'drag', 'out': 9}, {'st': 'G', 'nst': 'H', 'cond': 'crash', 'out': 10}, {'st': 'G', 'nst': 'E', 'cond': 'drag', 'out': 11}] class main: _state = 'A' def cond(self, c): global states for i in states: if i['st'] == self._state: if i['cond'] == c: self._state = i['nst'] return i['out'] raise KeyError def crash(self): return self.cond('crash') def close(self): return self.cond('close') def drag(self): return self.cond('drag')" "A = [[1, 0], [0, 'KeyError']] B = [[2, 1], [1, 'KeyError']] C = [[2, 'KeyError'], [3, 2]] D = [[0, 4], [4, 3]] E = [[1, 6], [5, 5]] F = [[2, 8], [6, 7]] G = [[7, 9], [2, 10]] H = [[7, 'KeyError'], [5, 11]] sett = [A, B, C, D, E, F, G, H] class Mili: def __init__(self): self.state = A def move(self): buf = self.state if buf[0][1] == 'KeyError': raise KeyError('KeyError') else: self.state = sett[self.state[0][0]] return buf[0][1] def rush(self): buf = self.state if buf[1][1] == 'KeyError': raise KeyError('KeyError') else: self.state = sett[self.state[1][0]] return buf[1][1] def main(): return Mili()" "A = [[0, 'KeyError'], [1, 0], [4, 1]] B = [[2, 2], [1, 'KeyError'], [1, 'KeyError']] C = [[3, 3], [2, 'KeyError'], [2, 'KeyError']] D = [[3, 'KeyError'], [4, 4], [3, 'KeyError']] E = [[2, 7], [6, 6], [5, 5]] F = [[5, 'KeyError'], [6, 8], [5, 'KeyError']] G = [[6, 'KeyError'], [1, 9], [6, 'KeyError']] sett = [A, B, C, D, E, F, G] class Mili: def __init__(self): self.state = A def sweep(self): buf = self.state if buf[0][1] == 'KeyError': raise KeyError('KeyError') self.state = sett[self.state[0][0]] return buf[0][1] def cut(self): buf = self.state if buf[1][1] == 'KeyError': raise KeyError('KeyError') self.state = sett[self.state[1][0]] return buf[1][1] def model(self): buf = self.state if buf[2][1] == 'KeyError': raise KeyError('KeyError') self.state = sett[self.state[2][0]] return buf[2][1] def main(): return Mili()" "class main: def __init__(self): self.__state = 'A' def skip(self): if self.__state == 'A': self.__state = 'B' return 0 if self.__state == 'B': self.__state = 'D' return 2 if self.__state == 'E': self.__state = 'B' return 7 if self.__state == 'F': self.__state = 'G' return 9 if self.__state == 'G': self.__state = 'H' return 11 raise KeyError def crash(self): if self.__state == 'B': self.__state = 'C' return 1 if self.__state == 'C': self.__state = 'D' return 3 if self.__state == 'D': self.__state = 'A' return 5 if self.__state == 'E': self.__state = 'F' return 6 raise KeyError def chat(self): if self.__state == 'F': self.__state = 'A' return 10 if self.__state == 'D': self.__state = 'E' return 4 if self.__state == 'E': self.__state = 'H' return 8 raise KeyError" "class main: def __init__(self): self.__state = 'A' def skip(self): if self.__state == 'A': self.__state = 'F' return 8 if self.__state == 'F': return 10 if self.__state == 'E': self.__state = 'F' return 8 if self.__state == 'G': self.__state = 'H' return 11 if self.__state == 'C': return 6 raise KeyError def crash(self): if self.__state == 'A': self.__state = 'B' return 0 if self.__state == 'B': self.__state = 'C' return 3 if self.__state == 'C': self.__state = 'E' return 5 if self.__state == 'D': self.__state = 'E' return 7 raise KeyError def drive(self): if self.__state == 'A': self.__state = 'H' return 1 if self.__state == 'F': self.__state = 'G' return 9 if self.__state == 'C': self.__state = 'D' return 4 raise KeyError" "class main: def __init__(self): self.state = 'A' self.put_dict = {'B': ['C', 1], 'E': ['H', 7], 'G': ['H', 10]} self.swap_dict = {'A': ['B', 0], 'D': ['B', 4], 'E': ['F', 5], 'F': ['G', 8], 'G': ['G', 11]} self.type_dict = {'C': ['D', 2], 'D': ['E', 3], 'E': ['G', 6], 'F': ['C', 9]} def swap(self): new_state = self.swap_dict[self.state] self.state = new_state[0] return new_state[1] def type(self): new_state = self.type_dict[self.state] self.state = new_state[0] return new_state[1] def put(self): new_state = self.put_dict[self.state] self.state = new_state[0] return new_state[1]" "class main: def __init__(self): self.condition = 'A' def speed(self): if self.condition == 'A': self.condition = 'B' return 0 elif self.condition == 'C': self.condition = 'D' return 2 elif self.condition == 'D': self.condition = 'B' return 5 elif self.condition == 'E': self.condition = 'F' return 6 elif self.condition == 'F': self.condition = 'A' return 7 else: raise KeyError def spawn(self): if self.condition == 'B': self.condition = 'C' return 1 elif self.condition == 'C': self.condition = 'F' return 3 elif self.condition == 'F': self.condition = 'D' return 8 elif self.condition == 'D': self.condition = 'E' return 4 else: raise KeyError" "class main: currentLetter = 'A' data = {'A': [{'letter': 'B', 'returned': 0, 'method': 'stall'}], 'B': [{'letter': 'C', 'returned': 1, 'method': 'stall'}, {'letter': 'D', 'returned': 2, 'method': 'load'}], 'C': [{'letter': 'F', 'returned': 5, 'method': 'load'}, {'letter': 'H', 'returned': 4, 'method': 'stall'}, {'letter': 'D', 'returned': 3, 'method': 'hike'}], 'D': [{'letter': 'E', 'returned': 6, 'method': 'hike'}], 'E': [{'letter': 'F', 'returned': 7, 'method': 'load'}, {'letter': 'H', 'returned': 8, 'method': 'stall'}], 'F': [{'letter': 'G', 'returned': 9, 'method': 'load'}], 'G': [{'letter': 'H', 'returned': 10, 'method': 'load'}, {'letter': 'A', 'returned': 11, 'method': 'stall'}], 'H': []} def __init__(self): pass def makeAction(self, name): variants = self.data[self.currentLetter] for item in variants: if item['method'] == name: self.currentLetter = item['letter'] return item['returned'] raise KeyError def stall(self): return self.makeAction('stall') def hike(self): return self.makeAction('hike') def load(self): return self.makeAction('load')" "class main: def __init__(self): self.__state = 'A' def etch(self): if self.__state == 'A': self.__state = 'B' return 0 if self.__state == 'B': self.__state = 'C' return 1 if self.__state == 'C': self.__state = 'D' return 3 if self.__state == 'D': self.__state = 'E' return 5 if self.__state == 'E': self.__state = 'F' return 6 if self.__state == 'G': self.__state = 'C' return 9 if self.__state == 'H': self.__state = 'B' return 10 raise KeyError def stall(self): if self.__state == 'B': self.__state = 'E' return 2 if self.__state == 'C': self.__state = 'H' return 4 if self.__state == 'F': self.__state = 'G' return 7 if self.__state == 'G': self.__state = 'H' return 8 if self.__state == 'H': self.__state = 'A' return 11 raise KeyError" "class main: def __init__(self): self.__state = 'A' def rig(self): if self.__state == 'E': self.__state = 'B' return 8 if self.__state == 'C': self.__state = 'F' return 5 raise KeyError def crash(self): if self.__state == 'A': self.__state = 'B' return 0 if self.__state == 'B': self.__state = 'F' return 2 if self.__state == 'E': self.__state = 'F' return 7 if self.__state == 'D': self.__state = 'E' return 6 if self.__state == 'C': self.__state = 'A' return 4 raise KeyError def crush(self): if self.__state == 'B': self.__state = 'C' return 1 if self.__state == 'C': self.__state = 'D' return 3 raise KeyError" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class main: state: State def __init__(self) -> None: self.state = State.A def wreck(self) -> int: if self.state == State.A: self.state = State.B return 0 elif self.state == State.C: self.state = State.D return 2 elif self.state == State.D: self.state = State.E return 4 elif self.state == State.F: self.state = State.D return 8 elif self.state == State.G: self.state = State.H return 9 else: raise KeyError def slur(self) -> int: if self.state == State.B: self.state = State.C return 1 elif self.state == State.C: self.state = State.E return 3 elif self.state == State.D: self.state = State.H return 5 elif self.state == State.E: self.state = State.F return 6 elif self.state == State.F: self.state = State.G return 7 elif self.state == State.G: self.state = State.A return 10 elif self.state == State.H: self.state = State.F return 11 else: raise KeyError" "from enum import Enum, auto class Main: class State(Enum): A = auto() B = auto() C = auto() D = auto() E = auto() F = auto() def __init__(self): self.__state = Main.State.A def bolt(self): match self.__state: case Main.State.A: self.__state = Main.State.B return 0 case Main.State.B: self.__state = Main.State.F return 3 case Main.State.E: self.__state = Main.State.A return 7 case _: raise KeyError def spawn(self): match self.__state: case Main.State.A: self.__state = Main.State.F return 1 case Main.State.B: self.__state = Main.State.C return 2 case Main.State.C: self.__state = Main.State.D return 4 case Main.State.D: self.__state = Main.State.E return 5 case Main.State.E: self.__state = Main.State.F return 6 case Main.State.F: self.__state = Main.State.D return 8 case _: raise KeyError def main() -> Main: return Main()" "class MileMachine: def __init__(self): self.ways = {'A': {'glare': (0, 'B')}, 'B': {'show': (1, 'C'), 'glare': (3, 'E'), 'bend': (2, 'F')}, 'C': {'bend': (4, 'D')}, 'D': {'glare': (5, 'E')}, 'E': {'show': (6, 'F')}, 'F': {'glare': (7, 'F'), 'show': (8, 'A')}} self.current = 'A' def move(self, method): number = self.ways[self.current][method][0] self.current = self.ways[self.current][method][1] return number def glare(self): return self.move('glare') def show(self): return self.move('show') def bend(self): return self.move('bend') def main(): return MileMachine()" "from enum import Enum class State(Enum): A = 1 B = 2 C = 3 D = 4 E = 5 F = 6 class main: def __init__(self): self.__state = State.A def smash(self) -> int: match self.__state: case State.A: self.__state = State.B return 0 case State.B: return 3 case State.C: self.__state = State.F return 5 case State.D: self.__state = State.E return 6 raise KeyError def start(self) -> int: match self.__state: case State.A: self.__state = State.C return 1 case State.B: self.__state = State.C return 2 case State.C: self.__state = State.D return 4 case State.D: return 7 raise KeyError def debug(self) -> int: match self.__state: case State.E: self.__state = State.F return 8 raise KeyError" "class main: char = 'A' def walk(self): if self.char == 'A': self.char = 'B' return 0 elif self.char == 'B': self.char = 'F' return 3 elif self.char == 'E': self.char = 'F' return 6 elif self.char == 'F': self.char = 'D' return 7 else: raise KeyError def run(self): if self.char == 'A': self.char = 'C' return 1 elif self.char == 'B': self.char = 'C' return 2 elif self.char == 'C': self.char = 'D' return 4 elif self.char == 'D': self.char = 'E' return 5 elif self.char == 'F': self.char = 'C' return 8 else: raise KeyError" "class main: def __init__(self): self.sos = 'A' def send(self): if self.sos == 'A': self.sos = 'B' return 0 elif self.sos == 'B': self.sos = 'C' return 1 elif self.sos == 'E': self.sos = 'F' return 6 elif self.sos == 'F': self.sos = 'F' return 7 else: raise KeyError def debug(self): if self.sos == 'C': self.sos = 'D' return 3 elif self.sos == 'D': self.sos = 'B' return 5 elif self.sos == 'B': self.sos = 'E' return 2 elif self.sos == 'F': self.sos = 'D' return 8 else: raise KeyError def crash(self): if self.sos == 'D': self.sos = 'E' return 4 else: raise KeyError" "class main(object): def __init__(self): self.state = 'A' def post(self): match self.state: case 'A': self.state = 'B' return 0 case 'C': self.state = 'A' return 4 case 'D': self.state = 'E' return 5 case 'E': self.state = 'B' return 7 raise KeyError def look(self): match self.state: case 'A': self.state = 'F' return 1 case 'B': self.state = 'C' return 2 case 'C': self.state = 'D' return 3 case 'E': self.state = 'F' return 6 case 'F': self.state = 'B' return 8 raise KeyError" "class main: def __init__(self): self.__state = 'A' def march(self): if self.__state == 'A': self.__state = 'B' return 0 if self.__state == 'B': self.__state = 'C' return 1 if self.__state == 'E': self.__state = 'F' return 5 if self.__state == 'F': self.__state = 'C' return 8 if self.__state == 'G': self.__state = 'H' return 9 if self.__state == 'D': self.__state = 'A' return 4 raise KeyError def color(self): if self.__state == 'C': self.__state = 'D' return 2 if self.__state == 'F': self.__state = 'G' return 7 if self.__state == 'G': self.__state = 'C' return 10 raise KeyError def fill(self): if self.__state == 'D': self.__state = 'E' return 3 if self.__state == 'E': self.__state = 'C' return 6 if self.__state == 'G': self.__state = 'A' return 11 raise KeyError" "class MealyMachine: STATE = 'A' def slog(self): if self.STATE == 'A': self.STATE = 'B' return 0 elif self.STATE == 'C': self.STATE = 'E' return 3 elif self.STATE == 'E': self.STATE = 'B' return 7 else: raise KeyError def punch(self): if self.STATE == 'B': self.STATE = 'C' return 1 elif self.STATE == 'D': self.STATE = 'F' return 5 elif self.STATE == 'E': self.STATE = 'F' return 6 elif self.STATE == 'F': self.STATE = 'B' return 8 else: raise KeyError def crush(self): if self.STATE == 'C': self.STATE = 'D' return 2 elif self.STATE == 'D': self.STATE = 'E' return 4 else: raise KeyError def main(): return MealyMachine()" "class main: pos = 'A' def chat(self): if self.pos == 'A': self.pos = 'B' return 0 elif self.pos == 'E': return 5 else: raise KeyError def warp(self): if self.pos == 'B': self.pos = 'C' return 1 elif self.pos == 'D': self.pos = 'E' return 3 elif self.pos == 'F': self.pos = 'G' return 6 elif self.pos == 'G': self.pos = 'E' return 9 else: raise KeyError def flip(self): if self.pos == 'C': self.pos = 'D' return 2 elif self.pos == 'E': self.pos = 'F' return 4 elif self.pos == 'F': self.pos = 'D' return 7 elif self.pos == 'G': self.pos = 'A' return 8 else: raise KeyError" "class main: def __init__(self): self.condition = 'A' def warp(self): if self.condition == 'A': self.condition = 'B' return 0 elif self.condition == 'B': self.condition = 'C' return 2 elif self.condition == 'C': self.condition = 'G' return 5 elif self.condition == 'D': self.condition = 'E' return 6 elif self.condition == 'E': self.condition = 'F' return 7 else: raise KeyError def mask(self): if self.condition == 'B': self.condition = 'G' return 3 elif self.condition == 'E': self.condition = 'C' return 8 elif self.condition == 'C': self.condition = 'D' return 4 elif self.condition == 'F': self.condition = 'G' return 9 elif self.condition == 'A': self.condition = 'H' return 1 elif self.condition == 'H': self.condition = 'D' return 11 elif self.condition == 'G': self.condition = 'H' return 10 else: raise KeyError" "class Ml: st = '' aa = 'a' bb = 'b' cc = 'c' dd = 'd' ee = 'e' ff = 'f' def __init__(self): self.st = self.aa def view(self): match self.st: case self.aa: self.st = self.bb return 0 case self.bb: self.st = self.cc return 1 case self.cc: self.st = self.dd return 3 case self.ee: self.st = self.ff return 6 case _: raise KeyError def coat(self): match self.st: case self.bb: self.st = self.ff return 2 case self.cc: self.st = self.ee return 4 case self.dd: self.st = self.ee return 5 case self.ee: self.st = self.aa return 7 case self.ff: return 8 case _: raise KeyError def main(): return Ml()" "class main: def __init__(self): self._cur_state = 'A' def rush(self): if self._cur_state == 'A': self._cur_state = 'B' return 0 if self._cur_state == 'D': self._cur_state = 'B' return 5 if self._cur_state == 'G': self._cur_state = 'B' return 9 raise KeyError() def look(self): if self._cur_state == 'B': self._cur_state = 'C' return 2 if self._cur_state == 'D': self._cur_state = 'E' return 4 if self._cur_state == 'F': self._cur_state = 'G' return 7 raise KeyError() def daub(self): if self._cur_state == 'A': self._cur_state = 'F' return 1 if self._cur_state == 'F': self._cur_state = 'C' return 8 if self._cur_state == 'C': self._cur_state = 'D' return 3 if self._cur_state == 'E': self._cur_state = 'F' return 6 raise KeyError()" "class main: cur = 'A' applyDic = {'A': ['B', 0], 'B': ['C', 2], 'C': ['D', 3], 'D': ['G', 6], 'F': ['G', 8]} growDic = {'A': ['F', 1], 'C': ['G', 4], 'D': ['E', 5], 'E': ['F', 7], 'F': ['C', 9]} def apply(self): old = self.cur self.cur = self.applyDic[self.cur][0] return self.applyDic[old][1] def grow(self): old = self.cur self.cur = self.growDic[self.cur][0] return self.growDic[old][1]" "class main: def __init__(self): self.status = 'A' def amass(self): match self.status: case 'A': self.status = 'A' return 1 case 'C': self.status = 'D' return 3 case 'D': self.status = 'E' return 4 case 'F': self.status = 'D' return 7 case _: raise KeyError def code(self): match self.status: case 'A': self.status = 'B' return 0 case 'B': self.status = 'C' return 2 case 'D': self.status = 'B' return 5 case 'E': self.status = 'F' return 6 case 'F': self.status = 'C' return 8 case _: raise KeyError" "class main: def __init__(self): self.status = 'A' def start(self): match self.status: case 'A': self.status = 'B' return 0 case 'E': self.status = 'F' return 5 case 'C': self.status = 'D' return 2 case 'D': self.status = 'E' return 4 case 'G': self.status = 'E' return 8 case 'F': self.status = 'A' return 7 case _: raise KeyError def throw(self): match self.status: case 'B': self.status = 'C' return 1 case 'C': self.status = 'E' return 3 case 'F': self.status = 'G' return 6 case 'G': self.status = 'C' return 9 case _: raise KeyError" "class main: def __init__(self): self.pos = 'A' def solve(self, dct): if self.pos in dct: ret = dct[self.pos][1] self.pos = dct[self.pos][0] return ret raise KeyError def crawl(self): return self.solve({'A': ['B', 0], 'E': ['F', 7], 'D': ['D', 5]}) def begin(self): return self.solve({'B': ['C', 1], 'D': ['A', 6], 'F': ['B', 8]}) def exit(self): return self.solve({'B': ['D', 2], 'C': ['D', 3], 'D': ['E', 4]})" "class fsm: def __init__(self): self.state = 'A' def bend(self): match self.state: case 'A': self.state = 'B' return 0 case 'D': self.state = 'D' return 7 case 'F': self.state = 'G' return 9 case _: raise KeyError() def glare(self): match self.state: case 'A': self.state = 'G' return 1 case 'B': self.state = 'C' return 2 case 'D': self.state = 'E' return 4 case 'E': self.state = 'F' return 8 case _: raise KeyError() def fork(self): match self.state: case 'C': self.state = 'D' return 3 case 'D': self.state = 'A' return 6 case 'G': self.state = 'H' return 10 case _: raise KeyError() def paint(self): match self.state: case 'D': self.state = 'G' return 5 case 'H': self.state = 'F' return 11 case _: raise KeyError() def main(): return fsm()" "class main: def __init__(self): self.pos = 'A' def solve(self, dct): if self.pos in dct: ret = dct[self.pos][1] self.pos = dct[self.pos][0] return ret raise KeyError def put(self): return self.solve({'A': ['B', 0], 'C': ['C', 4], 'D': ['E', 5]}) def race(self): return self.solve({'A': ['E', 1], 'B': ['C', 2], 'D': ['B', 6], 'E': ['F', 7]}) def reset(self): return self.solve({'C': ['D', 3], 'F': ['C', 8]})" "class main: def __init__(self): self.pos = 'A' def solve(self, dct): if self.pos in dct: ret = dct[self.pos][1] self.pos = dct[self.pos][0] return ret raise KeyError def peep(self): return self.solve({'A': ['B', 0], 'B': ['C', 1], 'D': ['D', 5], 'E': ['F', 6], 'F': ['F', 9]}) def flip(self): return self.solve({'B': ['D', 2], 'C': ['D', 3], 'E': ['C', 7], 'D': ['E', 4], 'F': ['G', 8]})" "class main: def __init__(self): self.pos = 'A' def solve(self, dct): if self.pos in dct: ret = dct[self.pos][1] self.pos = dct[self.pos][0] return ret raise KeyError def cast(self): return self.solve({'A': ['A', 1], 'C': ['A', 5], 'B': ['D', 3], 'E': ['F', 7]}) def clear(self): return self.solve({'A': ['B', 0], 'B': ['C', 2], 'C': ['D', 4], 'E': ['C', 8], 'D': ['E', 6]})" "class main: def __init__(self): self.currentPoint = 'A' def step(self): match self.currentPoint: case 'A': self.currentPoint = 'B' return 0 case 'B': self.currentPoint = 'F' return 2 case 'C': self.currentPoint = 'D' return 3 case 'D': self.currentPoint = 'E' return 5 case 'E': self.currentPoint = 'E' return 8 case _: raise KeyError def put(self): match self.currentPoint: case 'B': self.currentPoint = 'C' return 1 case 'C': self.currentPoint = 'E' return 4 case 'D': self.currentPoint = 'F' return 6 case 'E': self.currentPoint = 'F' return 7 case _: raise KeyError" "class Mul: def __init__(self): self.point = 'A' self.jumps = {'A': ('B', 0), 'C': ('D', 2), 'F': ('B', 9), 'E': ('F', 6)} self.visits = {'B': ('C', 1), 'F': ('F', 8), 'C': ('G', 4)} self.debugs = {'C': ('A', 3), 'D': ('E', 5), 'F': ('G', 7)} def jump(self): if self.point not in self.jumps: raise KeyError (self.point, res) = self.jumps[self.point] return res def debug(self): if self.point not in self.debugs: raise KeyError (self.point, res) = self.debugs[self.point] return res def visit(self): if self.point not in self.visits: raise KeyError (self.point, res) = self.visits[self.point] return res def main(): return Mul()" "from typing import Literal ACTION_TYPE = Literal['post', 'boost'] class Action: def __init__(self, type: ACTION_TYPE, code: int, target: str) -> None: self._type = type self._code = code self._target = target def get_type(self) -> str: return self._type def get_code(self) -> int: return self._code def get_target(self) -> str: return self._target class Auto: ACTIONS = {'A': [Action('post', 0, 'B'), Action('boost', 1, 'A')], 'B': [Action('post', 2, 'C')], 'C': [Action('post', 3, 'D')], 'D': [Action('post', 4, 'E'), Action('boost', 5, 'B')], 'E': [Action('boost', 6, 'F')], 'F': [Action('post', 7, 'G'), Action('boost', 8, 'D')], 'G': [Action('boost', 9, 'G')]} INITIAL_STATE = 'A' def __init__(self): self.state = self.INITIAL_STATE def _make_action(self, action_type: ACTION_TYPE) -> int: actions = self.ACTIONS[self.state] if not actions or actions is None: raise KeyError('Not found actions for state') action = next((x for x in actions if x.get_type() == action_type), None) if not action or action is None: raise KeyError('Not found actions for state') result_code = action.get_code() self.state = action.get_target() return result_code def post(self) -> int: return self._make_action('post') def boost(self) -> int: return self._make_action('boost') main = Auto" "class main: def __init__(self): self.this = 'A' def hop(self): if self.this == 'A': self.this = 'B' return 0 elif self.this == 'B': self.this = 'F' return 3 elif self.this == 'C': self.this = 'D' return 4 elif self.this == 'E': self.this = 'C' return 8 elif self.this == 'G': self.this = 'B' return 11 else: raise KeyError def paint(self): if self.this == 'A': self.this = 'E' return 1 elif self.this == 'E': self.this = 'F' return 6 elif self.this == 'F': self.this = 'G' return 9 elif self.this == 'G': self.this = 'H' return 10 else: raise KeyError def coat(self): if self.this == 'B': self.this = 'C' return 2 elif self.this == 'D': self.this = 'E' return 5 elif self.this == 'E': self.this = 'H' return 7 else: raise KeyError" "class FSM: states = {'A': {'pan': ('B', 0)}, 'B': {'pan': ('C', 1)}, 'C': {'pan': ('A', 3), 'rev': ('D', 2)}, 'D': {'rev': ('E', 4)}, 'E': {'rev': ('F', 5), 'pan': ('C', 6)}, 'F': {'rev': ('G', 7), 'pan': ('B', 8)}, 'G': {'pan': ('E', 9)}} current_state = 'A' def next_state(self, state_type): value = self.states[self.current_state][state_type][1] self.current_state = self.states[self.current_state][state_type][0] return value def pan(self): return self.next_state('pan') def rev(self): return self.next_state('rev') def main(): return FSM()" "class main: def __init__(self): main.state = A() def paste(self): try: return main.state.paste() except Exception as e: raise KeyError def log(self): try: return main.state.log() except Exception as e: raise KeyError def peep(self): try: return main.state.peep() except Exception as e: raise KeyError class A(main): def __init__(self): pass def log(self): return 1 def paste(self): main.state = B() return 0 class B(main): def __init__(self): pass def paste(self): return 3 def log(self): main.state = C() return 2 class C(main): def __init__(self): pass def peep(self): main.state = D() return 4 class D(main): def __init__(self): pass def paste(self): main.state = E() return 5 class E(main): def __init__(self): pass def paste(self): main.state = F() return 6 def peep(self): main.state = B() return 7 class F(main): def __init__(self): pass def paste(self): main.state = C() return 8" "class main: def __init__(self): self.name = 'A' def tag(self): match self.name: case 'A': self.name = 'B' return 0 case 'E': self.name = 'F' return 4 case 'F': self.name = 'C' return 6 case 'H': self.name = 'A' return 11 case _: raise KeyError def make(self): match self.name: case 'B': self.name = 'C' return 1 case 'F': self.name = 'A' return 7 case 'H': self.name = 'H' return 9 case _: raise KeyError def hurry(self): match self.name: case 'C': self.name = 'D' return 2 case 'D': self.name = 'E' return 3 case 'F': self.name = 'G' return 5 case 'G': self.name = 'H' return 8 case 'H': self.name = 'C' return 10 case _: raise KeyError" "class main: def __init__(self): self.pos = 'A' def solve(self, dct): if self.pos in dct: ret = dct[self.pos][1] self.pos = dct[self.pos][0] return ret raise KeyError def erase(self): return self.solve({'A': ['B', 0], 'D': ['E', 6], 'G': ['E', 10]}) def make(self): return self.solve({'A': ['G', 1], 'G': ['H', 9], 'C': ['D', 4]}) def sit(self): return self.solve({'B': ['C', 3], 'F': ['G', 8], 'A': ['H', 2], 'C': ['G', 5]}) def fill(self): return self.solve({'E': ['F', 7], 'G': ['B', 11]})" "class main: currentState = 'A' def mute(self): if self.currentState == 'A': self.currentState = 'B' return 0 elif self.currentState == 'C': self.currentState = 'D' return 2 elif self.currentState == 'D': self.currentState = 'E' return 5 elif self.currentState == 'E': self.currentState = 'F' return 7 else: raise KeyError('Error') def code(self): if self.currentState == 'B': self.currentState = 'C' return 1 elif self.currentState == 'C': self.currentState = 'G' return 3 elif self.currentState == 'D': self.currentState = 'B' return 6 elif self.currentState == 'G': self.currentState = 'A' return 9 else: raise KeyError('Error') def punch(self): if self.currentState == 'C': self.currentState = 'E' return 4 elif self.currentState == 'F': self.currentState = 'G' return 8 else: raise KeyError('Error')" "class Mile: def __init__(self): self.place = 'a' def swap(self): if self.place == 'a': self.place = 'b' return 0 if self.place == 'b': self.place = 'd' return 3 if self.place == 'e': self.place = 'f' return 8 else: raise KeyError def trim(self): if self.place == 'b': self.place = 'c' return 1 if self.place == 'c': return 5 if self.place == 'd': self.place = 'e' return 6 else: raise KeyError def spin(self): if self.place == 'b': self.place = 'e' return 2 if self.place == 'c': self.place = 'd' return 4 if self.place == 'd': return 7 else: raise KeyError def main(): return Mile()" "class Mealy: def __init__(self): self.state = 'A' def sit(self): if self.state == 'A': self.state = 'B' return 0 if self.state == 'B': self.state = 'E' return 3 if self.state == 'C': self.state = 'C' return 5 if self.state == 'D': self.state = 'E' return 6 if self.state == 'E': self.state = 'F' return 7 raise KeyError def trash(self): if self.state == 'A': self.state = 'D' return 1 if self.state == 'B': self.state = 'C' return 2 if self.state == 'C': self.state = 'D' return 4 if self.state == 'E': self.state = 'C' return 8 raise KeyError def main(): return Mealy()" "class MileMachine: def __init__(self): self.state = 'A' def scale(self): if self.state == 'A': self.state = 'B' return 0 if self.state == 'C': self.state = 'D' return 3 if self.state == 'D': self.state = 'E' return 5 if self.state == 'E': self.state = 'F' return 6 if self.state == 'G': self.state = 'A' return 9 raise KeyError() def carve(self): if self.state == 'A': self.state = 'C' return 1 if self.state == 'B': self.state = 'C' return 2 if self.state == 'C': self.state = 'G' return 4 if self.state == 'E': return 7 if self.state == 'F': self.state = 'G' return 8 raise KeyError() def main(): return MileMachine()" "class main: def __init__(self): self.sost = 'a' def join(self): if self.sost == 'a': self.sost = 'b' return 0 elif self.sost == 'c': self.sost = 'd' return 2 elif self.sost == 'd': self.sost = 'e' return 4 else: raise KeyError def herd(self): if self.sost == 'b': self.sost = 'c' return 1 else: raise KeyError def tag(self): if self.sost == 'c': self.sost = 'e' return 3 elif self.sost == 'e': self.sost = 'f' return 5 elif self.sost == 'f': self.sost = 'g' return 7 elif self.sost == 'g': self.sost = 'a' return 10 else: raise KeyError def reset(self): if self.sost == 'e': self.sost = 'a' return 6 elif self.sost == 'f': self.sost = 'c' return 8 elif self.sost == 'g': self.sost = 'h' return 9 elif self.sost == 'h': self.sost = 'b' return 11 else: raise KeyError" "class Mile: def __init__(self): self.place = 'a' def cull(self): if self.place == 'a': self.place = 'b' return 0 elif self.place == 'b': self.place = 'e' return 3 elif self.place == 'e': self.place = 'c' return 8 elif self.place == 'c': self.place = 'f' return 5 elif self.place == 'f': self.place = 'g' return 9 else: raise KeyError def unite(self): if self.place == 'b': self.place = 'c' return 1 elif self.place == 'd': self.place = 'e' return 6 elif self.place == 'c': self.place = 'd' return 4 elif self.place == 'e': self.place = 'f' return 7 else: raise KeyError def view(self): if self.place == 'b': self.place = 'd' return 2 else: raise KeyError def main(): return Mile()" "class Mile: def __init__(self): self.place = 'a' def skew(self): if self.place == 'a': self.place = 'b' return 0 if self.place == 'b': return 3 if self.place == 'f': self.place = 'g' return 7 else: raise KeyError def crawl(self): if self.place == 'b': self.place = 'c' return 1 if self.place == 'c': self.place = 'd' return 4 if self.place == 'f': self.place = 'b' return 8 if self.place == 'g': self.place = 'a' return 9 else: raise KeyError def slip(self): if self.place == 'b': self.place = 'd' return 2 if self.place == 'd': self.place = 'e' return 5 if self.place == 'e': self.place = 'f' return 6 else: raise KeyError def main(): return Mile()" "class Mile: def __init__(self): self.place = 'a' def jump(self): if self.place == 'a': self.place = 'b' return 0 if self.place == 'b': self.place = 'f' return 2 if self.place == 'c': return 4 if self.place == 'd': self.place = 'e' return 5 if self.place == 'e': self.place = 'f' return 6 if self.place == 'f': self.place = 'g' return 9 else: raise KeyError def jog(self): if self.place == 'b': self.place = 'c' return 1 if self.place == 'e': return 7 else: raise KeyError def spin(self): if self.place == 'c': self.place = 'd' return 3 if self.place == 'e': self.place = 'g' return 8 if self.place == 'g': self.place = 'h' return 10 if self.place == 'h': self.place = 'b' return 11 else: raise KeyError def main(): return Mile()" "class States: A = list() B = list() C = list() D = list() E = list() F = list() class StateMachine: state = States.A def __init__(self): States.A.append(('drive', 0, States.B)) States.B.append(('join', 1, States.C)) States.B.append(('lower', 2, States.F)) States.C.append(('lower', 3, States.D)) States.D.append(('drive', 4, States.E)) States.E.append(('lower', 5, States.F)) States.E.append(('drive', 6, States.C)) States.E.append(('join', 7, States.B)) States.F.append(('join', 8, States.C)) def __get_next_node(self, method_name): found = None for node in self.state: if node[0] == method_name: found = node break return found def base_method(self, next_state): if next_state is not None: self.state = next_state[2] return next_state[1] else: raise KeyError('No such edge!') def drive(self): next_state = self.__get_next_node('drive') return self.base_method(next_state) def join(self): next_state = self.__get_next_node('join') return self.base_method(next_state) def lower(self): next_state = self.__get_next_node('lower') return self.base_method(next_state) def main(): return StateMachine()" "class States: A = list() B = list() C = list() D = list() E = list() F = list() G = list() H = list() class StateMachine: state = States.A def __init__(self): States.A.append(('stop', 0, States.B)) States.B.append(('click', 1, States.C)) States.C.append(('click', 2, States.D)) States.C.append(('stay', 3, States.H)) States.D.append(('stop', 4, States.E)) States.D.append(('click', 5, States.G)) States.D.append(('stay', 6, States.B)) States.E.append(('stop', 7, States.F)) States.F.append(('stay', 8, States.G)) States.F.append(('stop', 9, States.D)) States.G.append(('stop', 10, States.H)) States.H.append(('stay', 11, States.A)) def __get_next_node(self, method_name): found = None for node in self.state: if node[0] == method_name: found = node break return found def base_method(self, next_state): if next_state is not None: self.state = next_state[2] return next_state[1] else: raise KeyError('No such edge!') def stop(self): next_state = self.__get_next_node('stop') return self.base_method(next_state) def click(self): next_state = self.__get_next_node('click') return self.base_method(next_state) def stay(self): next_state = self.__get_next_node('stay') return self.base_method(next_state) def main(): return StateMachine()" "class FSM: def __init__(self): self.state = 'A' def set_state(self, state): self.state = state def get_state(self): return self.state def erase(self): match self.get_state(): case 'A': self.set_state('B') return 0 case 'B': self.set_state('C') return 1 case 'C': self.set_state('D') return 4 case 'D': self.set_state('A') return 6 case _: raise KeyError('KeyError') def rock(self): match self.get_state(): case 'B': return 2 case 'D': self.set_state('F') return 7 case 'E': self.set_state('F') return 8 case 'F': self.set_state('G') return 9 case _: raise KeyError('KeyError') def pull(self): match self.get_state(): case 'D': self.set_state('E') return 5 case 'G': self.set_state('B') return 3 case _: raise KeyError('KeyError') def main(): return FSM()" "class Mealy: def __init__(self): self.state = 'A' def file(self): transitions = {'A': ['B', 0], 'B': ['C', 2], 'D': ['B', 5], 'E': ['F', 7], 'F': ['D', 9]} (new_state, output) = transitions[self.state] self.state = new_state return output def code(self): transitions = {'A': ['G', 1], 'D': ['G', 6]} (new_state, output) = transitions[self.state] self.state = new_state return output def mute(self): transitions = {'C': ['D', 3], 'D': ['E', 4], 'F': ['G', 8]} (new_state, output) = transitions[self.state] self.state = new_state return output def main(): return Mealy()" "from enum import Enum, auto class State(Enum): A = auto() B = auto() C = auto() D = auto() E = auto() F = auto() G = auto() H = auto() def main(): return Main() class Main: def __init__(self) -> None: self.state = State.A def coat(self): match self.state: case State.A: self.state = State.F return 1 case State.F: self.state = State.G return 9 case State.G: self.state = State.H return 10 case State.C: self.state = State.E return 4 case State.D: self.state = State.E return 6 case State.E: self.state = State.F return 8 case State.B: raise KeyError() case State.H: raise KeyError() def cast(self): match self.state: case State.A: self.state = State.B return 0 case State.B: raise KeyError() case State.C: self.state = State.G return 5 case State.D: raise KeyError() case State.E: raise KeyError() case State.F: raise KeyError() case State.G: return 11 case State.H: raise KeyError() def march(self): match self.state: case State.B: self.state = State.C return 2 case State.C: self.state = State.D return 3 case State.D: self.state = State.H return 7 case State.A: raise KeyError() case State.E: raise KeyError() case State.F: raise KeyError() case State.G: raise KeyError() case State.H: raise KeyError()" "class Mili: i = 1 def slur(self): if self.i == 1: self.i = 1 return self.i elif self.i == 0 or self.i == 8: self.i = 2 return self.i elif self.i == 4: self.i = 7 return self.i else: raise KeyError def spawn(self): if self.i == 1: self.i = 0 return self.i elif self.i == 2 or self.i == 7: self.i = 3 return self.i elif self.i == 3 or self.i == 5: self.i = 5 return self.i elif self.i == 4: self.i = 6 return self.i else: raise KeyError def group(self): if self.i == 4: self.i = 8 return self.i elif self.i == 3 or self.i == 5: self.i = 4 return self.i else: raise KeyError def main(): o = Mili() return o" "class main: stat = 'A' def close(self): match self.stat: case 'A': return 2 case 'C': return 5 case 'G': self.stat = 'H' return 9 case 'H': self.stat = 'A' return 11 case _: raise KeyError def boost(self): match self.stat: case 'A': self.stat = 'B' return 0 case 'C': self.stat = 'D' return 4 case 'D': self.stat = 'E' return 6 case 'H': self.stat = 'F' return 10 case _: raise KeyError def unite(self): match self.stat: case 'B': self.stat = 'C' return 3 case 'E': self.stat = 'F' return 7 case _: raise KeyError def punch(self): match self.stat: case 'A': self.stat = 'D' return 1 case 'F': self.stat = 'G' return 8 case _: raise KeyError" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def fork(self): return self.update({State.A: [State.B, 0], State.E: [State.G, 7], State.F: [State.G, 8], State.H: [State.B, 11]}) def log(self): return self.update({State.A: [State.G, 1], State.B: [State.C, 2], State.D: [State.E, 4]}) def peep(self): return self.update({State.C: [State.D, 3], State.D: [State.A, 5], State.E: [State.F, 6], State.G: [State.H, 10], State.F: [State.B, 9]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main: now_el = 'A' file_dict = {'A': '0B', 'D': '4E', 'F': '7A', 'E': '6C'} rush_dict = {'A': '1C', 'B': '2C', 'C': '3D', 'E': '5F', 'F': '8D'} def file(self): next_cl = self.now_el if self.file_dict.get(next_cl, 'KeyError')[1] != 'e': self.now_el = self.file_dict.get(next_cl, 'KeyError')[1] return int(self.file_dict.get(next_cl)[0]) else: raise KeyError def rush(self): next_cl = self.now_el if self.rush_dict.get(next_cl, 'KeyError')[1] != 'e': self.now_el = self.rush_dict.get(next_cl, 'KeyError')[1] return int(self.rush_dict.get(next_cl)[0]) else: raise KeyError" "class main(object): def __init__(this): this.state = 'A' def clean(this): if this.state == 'A': this.state = 'B' return 0 if this.state == 'C': this.state = 'A' return 3 if this.state == 'D': this.state = 'B' return 5 if this.state == 'E': this.state = 'A' return 7 else: raise KeyError() def align(this): if this.state == 'B': this.state = 'C' return 1 if this.state == 'C': this.state = 'D' return 2 if this.state == 'D': this.state = 'E' return 4 if this.state == 'E': this.state = 'F' return 6 if this.state == 'F': this.state = 'D' return 8 else: raise KeyError()" "class main(object): def __init__(this): this.state = 'A' def melt(this): if this.state == 'A': this.state = 'B' return 0 if this.state == 'B': this.state = 'F' return 3 else: raise KeyError() def clear(this): if this.state == 'B': this.state = 'B' return 4 if this.state == 'C': this.state = 'D' return 5 if this.state == 'E': this.state = 'F' return 8 else: raise KeyError() def close(this): if this.state == 'A': this.state = 'C' return 1 if this.state == 'B': this.state = 'C' return 2 if this.state == 'C': this.state = 'C' return 6 if this.state == 'D': this.state = 'E' return 7 else: raise KeyError()" "class Automat: def __init__(self): self.state = 'A' def make(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'E': self.state = 'B' return 7 elif self.state == 'D': self.state = 'F' return 5 elif self.state == 'F': self.state = 'H' return 9 elif self.state == 'G': self.state = 'H' return 10 else: raise KeyError def clear(self): if self.state == 'B': self.state = 'C' return 1 elif self.state == 'C': self.state = 'D' return 2 elif self.state == 'D': self.state = 'B' return 4 elif self.state == 'G': self.state = 'E' return 11 else: raise KeyError def put(self): if self.state == 'F': self.state = 'G' return 8 elif self.state == 'D': self.state = 'E' return 3 elif self.state == 'E': self.state = 'F' return 6 else: raise KeyError def main(): return Automat()" "class GraphVertex: def __init__(self, has_dash, has_send, value_dash, value_send, next_dash, next_send): self.has_dash = has_dash self.has_send = has_send self.value_dash = value_dash self.value_send = value_send self.next_dash = next_dash self.next_send = next_send class Graph: def __init__(self, root): self.current_vertex = root def dash(self): if self.current_vertex.has_dash: value = self.current_vertex.value_dash self.current_vertex = self.current_vertex.next_dash return value else: raise KeyError def send(self): if self.current_vertex.has_send: value = self.current_vertex.value_send self.current_vertex = self.current_vertex.next_send return value else: raise KeyError def main(): vertex6 = GraphVertex(False, True, None, 9, None, None) vertex6.next_send = vertex6 vertex5 = GraphVertex(True, False, 8, None, vertex6, None) vertex4 = GraphVertex(False, True, None, 7, None, vertex5) vertex3 = GraphVertex(True, False, 6, None, vertex4, None) vertex2 = GraphVertex(True, True, 4, 5, vertex3, vertex5) vertex1 = GraphVertex(True, True, 2, 3, vertex2, vertex5) vertex0 = GraphVertex(True, True, 0, 1, vertex1, vertex6) return Graph(vertex0) o = main() o = main()" "class Mile: def __init__(self): self.place = 'a' def chalk(self): if self.place == 'a': self.place = 'b' return 0 if self.place == 'b': self.place = 'c' return 2 if self.place == 'c': self.place = 'd' return 4 if self.place == 'e': self.place = 'f' return 7 if self.place == 'g': self.place = 'h' return 10 else: raise KeyError def hoard(self): if self.place == 'a': self.place = 'g' return 1 if self.place == 'b': self.place = 'd' return 3 if self.place == 'c': self.place = 'e' return 5 if self.place == 'd': self.place = 'e' return 6 if self.place == 'e': self.place = 'h' return 8 if self.place == 'f': self.place = 'g' return 9 if self.place == 'g': self.place = 'd' return 11 else: raise KeyError def main(): return Mile()" "class Automat: current_state = 'A' def punch(self): if self.current_state == 'A': self.current_state = 'B' return 0 if self.current_state == 'B': self.current_state = 'C' return 3 if self.current_state == 'E': self.current_state = 'F' return 6 raise KeyError def view(self): if self.current_state == 'A': self.current_state = 'F' return 2 if self.current_state == 'C': self.current_state = 'D' return 4 if self.current_state == 'D': self.current_state = 'E' return 5 if self.current_state == 'E': self.current_state = 'B' return 7 if self.current_state == 'F': self.current_state = 'D' return 8 raise KeyError def scrub(self): if self.current_state == 'A': self.current_state = 'D' return 1 raise KeyError def main(): return Automat()" "class main: def __init__(self): self.__state = 'A' def widen(self): if self.__state == 'A': self.__state = 'B' return 0 if self.__state == 'B': return 2 if self.__state == 'D': self.__state = 'A' return 5 if self.__state == 'E': self.__state = 'F' return 6 if self.__state == 'G': return 10 if self.__state == 'F': self.__state = 'G' return 8 raise KeyError def crash(self): if self.__state == 'B': self.__state = 'C' return 1 if self.__state == 'C': self.__state = 'D' return 3 if self.__state == 'D': self.__state = 'E' return 4 if self.__state == 'G': self.__state = 'C' return 11 raise KeyError def reset(self): if self.__state == 'G': self.__state = 'H' return 9 if self.__state == 'E': self.__state = 'H' return 7 raise KeyError" "def main(): class Status: A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class FSM: def get(self): if self.status == Status.A: return 2 elif self.status == Status.B: self.status = Status.C return 3 elif self.status == Status.D: self.status = Status.E return 5 elif self.status == Status.F: self.status = Status.D return 8 else: raise KeyError def march(self): if self.status == Status.A: self.status = Status.B return 0 elif self.status == Status.C: self.status = Status.D return 4 elif self.status == Status.E: self.status = Status.A return 7 else: raise KeyError def check(self): if self.status == Status.A: self.status = Status.D return 1 elif self.status == Status.E: self.status = Status.F return 6 else: raise KeyError def __init__(self): self.status = Status.A return FSM()" "class main: now_letter = 'A' slov_loop = {'A': '1F', 'E': '7F', 'F': '9G', 'G': '10H', 'H': '11E', 'B': '2C', 'C': '5H', 'D': '6E'} slov_drag = {'A': '0B', 'B': '3B', 'E': '8A', 'C': '4D'} def loop(self): temp_drive = self.now_letter if len(self.slov_loop.get(temp_drive, 'KeyError')) > 2: if self.slov_loop.get(temp_drive, 'KeyError')[:2] != 'Ke': self.now_letter = self.slov_loop.get(temp_drive, 'KeyError')[2] return int(self.slov_loop.get(temp_drive)[:2]) else: raise KeyError elif self.slov_loop.get(temp_drive, 'KeyError')[1] != 'e': self.now_letter = self.slov_loop.get(temp_drive, 'KeyError')[1] return int(self.slov_loop.get(temp_drive)[0]) else: raise KeyError def drag(self): temp_fetch = self.now_letter if self.slov_drag.get(temp_fetch, 'KeyError')[1] != 'e': self.now_letter = self.slov_drag.get(temp_fetch, 'KeyError')[1] return int(self.slov_drag.get(temp_fetch)[0]) else: raise KeyError" "import enum class MilliState(enum.Enum): STATE_A = 0 STATE_B = 1 STATE_C = 2 STATE_D = 3 STATE_E = 4 STATE_F = 5 STATE_G = 6 STATE_H = 7 class Milli: def __init__(self, state): self._state = state def post(self): if self._state == MilliState.STATE_A: self._state = MilliState.STATE_B return 0 elif self._state == MilliState.STATE_C: self._state = MilliState.STATE_F return 4 elif self._state == MilliState.STATE_F: self._state = MilliState.STATE_G return 7 else: raise KeyError def merge(self): if self._state == MilliState.STATE_B: self._state = MilliState.STATE_C return 1 elif self._state == MilliState.STATE_G: self._state = MilliState.STATE_D return 9 elif self._state == MilliState.STATE_H: self._state = MilliState.STATE_F return 10 else: raise KeyError def align(self): if self._state == MilliState.STATE_B: self._state = MilliState.STATE_D return 2 else: raise KeyError def stare(self): if self._state == MilliState.STATE_C: self._state = MilliState.STATE_D return 3 elif self._state == MilliState.STATE_D: self._state = MilliState.STATE_E return 5 elif self._state == MilliState.STATE_E: self._state = MilliState.STATE_F return 6 elif self._state == MilliState.STATE_G: self._state = MilliState.STATE_H return 8 elif self._state == MilliState.STATE_H: self._state = MilliState.STATE_A return 11 else: raise KeyError def main(): return Milli(MilliState.STATE_A)" "class main: a = 0 sost = 'A' def mask(self): dict = {'A': [0, 'B'], 'B': [1, 'C'], 'C': [4, 'C'], 'D': [5, 'E'], 'E': [6, 'F'], 'F': [8, 'C']} for (key, value) in dict.items(): if key == self.sost: self.a = value[0] self.sost = value[1] return self.a def glare(self): dict = {'A': KeyError, 'B': [2, 'D'], 'C': [3, 'D'], 'D': KeyError, 'E': KeyError, 'F': [7, 'A']} for (key, value) in dict.items(): if key == self.sost: if value == KeyError: raise KeyError else: self.a = value[0] self.sost = value[1] return self.a" "class Milly: def __init__(self): self.current_state = 'A' self.COLOR = {'A': {'value': 0, 'new_state': 'B'}, 'B': {'value': 2, 'new_state': 'D'}, 'F': {'value': 7, 'new_state': 'G'}} self.SEND = {'B': {'value': 1, 'new_state': 'C'}, 'D': {'value': 4, 'new_state': 'E'}, 'E': {'value': 6, 'new_state': 'E'}, 'G': {'value': 11, 'new_state': 'E'}, 'F': {'value': 9, 'new_state': 'A'}} self.ZOOM = {'C': {'value': 3, 'new_state': 'D'}, 'E': {'value': 5, 'new_state': 'F'}, 'F': {'value': 8, 'new_state': 'B'}, 'G': {'value': 10, 'new_state': 'H'}} def color(self): res = self.COLOR[self.current_state] self.current_state = res['new_state'] return res['value'] def send(self): res = self.SEND[self.current_state] self.current_state = res['new_state'] return res['value'] def zoom(self): res = self.ZOOM[self.current_state] self.current_state = res['new_state'] return res['value'] def main(): return Milly()" "class Miles: def __init__(self): self.state = 'A' def base(self): if self.state == 'A': self.state = 'B' return 0 if self.state == 'C': self.state = 'D' return 5 if self.state == 'E': self.state = 'F' return 8 else: raise KeyError def trace(self): if self.state == 'A': self.state = 'F' return 2 if self.state == 'B': self.state = 'C' return 3 if self.state == 'D': self.state = 'A' return 7 if self.state == 'F': self.state = 'G' return 9 else: raise KeyError def patch(self): if self.state == 'A': self.state = 'E' return 1 if self.state == 'B': self.state = 'G' return 4 if self.state == 'D': self.state = 'E' return 6 else: raise KeyError def main(): return Miles()" "class main(object): state = 'A' def __init__(self): pass def erase(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 2 elif self.state == 'D': self.state = 'A' return 5 elif self.state == 'E': self.state = 'F' return 6 elif self.state == 'F': self.state = 'B' return 9 else: raise KeyError def coast(self): if self.state == 'C': self.state = 'D' return 3 elif self.state == 'D': self.state = 'E' return 4 elif self.state == 'E': self.state = 'B' return 7 elif self.state == 'F': self.state = 'G' return 8 elif self.state == 'G': self.state = 'H' return 10 elif self.state == 'H': self.state = 'C' return 11 elif self.state == 'A': self.state = 'G' return 1 else: raise KeyError" "class main: state = '' def __init__(self): self.state = 'A' def split(self): if self.state == 'A': self.state = 'B' return 0 if self.state == 'B': self.state = 'C' return 2 if self.state == 'C': self.state = 'F' return 4 if self.state == 'F': self.state = 'G' return 7 if self.state == 'G': self.state = 'B' return 9 raise KeyError() def stash(self): if self.state == 'A': self.state = 'C' return 1 if self.state == 'C': self.state = 'D' return 3 if self.state == 'D': self.state = 'E' return 5 if self.state == 'E': self.state = 'F' return 6 if self.state == 'F': return 8 raise KeyError() pass" "class main: def __init__(self): self.cur_state = 'A' def etch(self): if self.cur_state == 'A': self.cur_state = 'B' return 0 elif self.cur_state == 'E': self.cur_state = 'B' return 7 elif self.cur_state == 'B': self.cur_state = 'C' return 2 else: raise KeyError def check(self): if self.cur_state == 'C': self.cur_state = 'D' return 3 elif self.cur_state == 'E': self.cur_state = 'F' return 5 elif self.cur_state == 'F': self.cur_state = 'C' return 8 elif self.cur_state == 'A': self.cur_state = 'F' return 1 else: raise KeyError def order(self): if self.cur_state == 'E': self.cur_state = 'A' return 6 elif self.cur_state == 'D': self.cur_state = 'E' return 4 else: raise KeyError" "class main: def __init__(self): self.q = 'A' def shade(self): if self.q == 'A': self.q = 'B' return 0 if self.q == 'B': self.q = 'D' return 2 if self.q == 'E': self.q = 'F' return 6 raise KeyError pass def log(self): if self.q == 'B': self.q = 'C' return 1 if self.q == 'C': self.q = 'D' return 3 if self.q == 'F': self.q = 'G' return 7 if self.q == 'G': self.q = 'C' return 9 raise KeyError pass def merge(self): if self.q == 'C': self.q = 'A' return 4 if self.q == 'D': self.q = 'E' return 5 if self.q == 'F': self.q = 'D' return 8 raise KeyError pass o = main()" "class main: def __init__(self): self.name = 'A' def align(self): if self.name == 'A': self.name = 'F' return 1 elif self.name == 'C': self.name = 'D' return 4 elif self.name == 'G': self.name = 'H' return 9 else: raise KeyError def cull(self): if self.name == 'A': self.name = 'B' return 0 elif self.name == 'D': self.name = 'E' return 5 elif self.name == 'G': self.name = 'B' return 10 elif self.name == 'H': self.name = 'B' return 11 else: raise KeyError def mask(self): if self.name == 'A': return 2 elif self.name == 'B': self.name = 'C' return 3 elif self.name == 'D': self.name = 'A' return 6 elif self.name == 'E': self.name = 'F' return 7 elif self.name == 'F': self.name = 'G' return 8 else: raise KeyError" "class main: def __init__(self): self.state = 'A' def coat(self): if self.state == 'A': self.state = 'B' return 0 if self.state == 'B': self.state = 'C' return 3 if self.state == 'D': self.state = 'E' return 6 if self.state == 'E': self.state = 'F' return 7 if self.state == 'F': self.state = 'G' return 8 else: raise KeyError def join(self): if self.state == 'A': self.state = 'G' return 1 if self.state == 'B': return 4 if self.state == 'C': self.state = 'D' return 5 else: raise KeyError def unite(self): if self.state == 'A': self.state = 'E' return 2 if self.state == 'G': self.state = 'E' return 9 else: raise KeyError" "class main: def __init__(self): self.q = 'A' def widen(self): if self.q == 'A': self.q = 'B' return 0 if self.q == 'B': self.q = 'C' return 1 if self.q == 'C': self.q = 'D' return 3 if self.q == 'E': self.q = 'E' return 7 if self.q == 'F': self.q = 'B' return 8 raise KeyError def mix(self): if self.q == 'B': self.q = 'B' return 2 if self.q == 'C': self.q = 'C' return 4 if self.q == 'D': self.q = 'E' return 5 if self.q == 'E': self.q = 'F' return 6 raise KeyError" "class MyClass: def __init__(self): self.state = 'A' def skip(self): if self.state == 'A': self.state = 'B' return int(0) elif self.state == 'B': self.state = 'C' return int(1) elif self.state == 'D': self.state = 'F' return int(4) elif self.state == 'F': self.state = 'B' return int(8) elif self.state == 'E': self.state = 'F' return int(5) else: raise KeyError def grow(self): if self.state == 'C': self.state = 'D' return int(2) elif self.state == 'D': self.state = 'E' return int(3) elif self.state == 'F': self.state = 'F' return int(7) elif self.state == 'E': self.state = 'B' return int(6) else: raise KeyError def main(): return MyClass()" "class main: def __init__(self): self.state = 'A' self.sort_dict = {'A': ['B', 0], 'C': ['E', 4], 'D': ['D', 6]} self.code_dict = {'B': ['C', 2], 'C': ['D', 3], 'D': ['F', 7], 'E': ['F', 8]} self.hurry_dict = {'A': ['D', 1], 'D': ['E', 5]} def sort(self): value = self.sort_dict[self.state] self.state = value[0] return value[1] def code(self): value = self.code_dict[self.state] self.state = value[0] return value[1] def hurry(self): value = self.hurry_dict[self.state] self.state = value[0] return value[1]" "class main: def __init__(self): self.status = 'A' def patch(self): match self.status: case 'A': self.status = 'B' return 0 case 'C': self.status = 'C' return 4 case 'E': return 7 case _: raise KeyError def crack(self): match self.status: case 'A': self.status = 'E' return 1 case 'B': self.status = 'C' return 2 case 'C': self.status = 'D' return 3 case 'D': self.status = 'E' return 6 case _: raise KeyError def daub(self): match self.status: case 'C': self.status = 'F' return 5 case 'E': self.status = 'B' return 8 case _: raise KeyError" "class main: def __init__(self): self.status = 'A' def loop(self): match self.status: case 'A': self.status = 'B' return 0 case 'E': return 8 case _: raise KeyError def pose(self): match self.status: case 'D': self.status = 'A' return 5 case 'C': self.status = 'E' return 3 case 'E': self.status = 'F' return 6 case _: raise KeyError def put(self): match self.status: case 'E': self.status = 'A' return 7 case 'B': self.status = 'C' return 1 case 'C': self.status = 'D' return 2 case 'D': self.status = 'E' return 4 case _: raise KeyError" "class main: def __init__(self): self.q = 'A' def bend(self): if self.q == 'A': self.q = 'B' return 0 if self.q == 'D': self.q = 'E' return 4 if self.q == 'E': self.q = 'C' return 6 if self.q == 'F': self.q = 'A' return 8 raise KeyError pass def spin(self): if self.q == 'B': self.q = 'C' return 1 if self.q == 'E': self.q = 'A' return 7 raise KeyError pass def put(self): if self.q == 'C': self.q = 'D' return 3 if self.q == 'B': self.q = 'D' return 2 if self.q == 'E': self.q = 'F' return 5 raise KeyError pass o = main()" "class main(object): state = 'A' def dash(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'E': self.state = 'F' return 5 else: raise KeyError() def begin(self): if self.state == 'B': self.state = 'C' return 1 elif self.state == 'C': self.state = 'D' return 3 elif self.state == 'E': return 6 elif self.state == 'F': self.state = 'A' return 8 else: raise KeyError() def init(self): if self.state == 'B': self.state = 'D' return 2 elif self.state == 'D': self.state = 'E' return 4 elif self.state == 'E': self.state = 'B' return 7 else: raise KeyError()" "class FSM: def __init__(self): self.A = 'A' self.B = 'B' self.C = 'C' self.D = 'D' self.E = 'E' self.F = 'F' self.start = self.A self.current_state = self.start def peep(self): if self.current_state == self.B: self.current_state = self.C return 1 elif self.current_state == self.C: self.current_state = self.D return 2 elif self.current_state == self.D: self.current_state = self.B return 4 elif self.current_state == self.E: self.current_state = self.F return 5 elif self.current_state == self.F: self.current_state = self.A return 7 else: raise KeyError def mix(self): if self.current_state == self.A: self.current_state = self.B return 0 elif self.current_state == self.D: self.current_state = self.E return 3 elif self.current_state == self.E: self.current_state = self.B return 6 elif self.current_state == self.F: self.current_state = self.B return 8 else: raise KeyError def main(): evaluator = FSM() return evaluator" "class FSM: def __init__(self): self.A = 'A' self.B = 'B' self.C = 'C' self.D = 'D' self.E = 'E' self.F = 'F' self.G = 'G' self.start = self.A self.current_state = self.start def smash(self): if self.current_state == self.A: self.current_state = self.B return 0 elif self.current_state == self.C: self.current_state = self.D return 4 else: raise KeyError def sweep(self): if self.current_state == self.A: self.current_state = self.F return 1 elif self.current_state == self.B: self.current_state = self.C return 3 elif self.current_state == self.E: self.current_state = self.F return 7 elif self.current_state == self.G: return 9 else: raise KeyError def send(self): if self.current_state == self.A: self.current_state = self.E return 2 elif self.current_state == self.C: self.current_state = self.A return 5 elif self.current_state == self.D: self.current_state = self.E return 6 elif self.current_state == self.F: self.current_state = self.G return 8 else: raise KeyError def main(): state_machine = FSM() return state_machine" "class main: def __init__(self): self.status = 'A' def jump(self): match self.status: case 'A': self.status = 'B' return 0 case 'B': self.status = 'E' return 2 case 'C': self.status = 'D' return 4 case 'E': self.status = 'F' return 6 case _: raise KeyError def crack(self): match self.status: case 'B': self.status = 'C' return 1 case 'F': self.status = 'C' return 8 case 'D': self.status = 'E' return 5 case _: raise KeyError def loop(self): match self.status: case 'B': self.status = 'G' return 3 case 'F': self.status = 'G' return 7 case 'G': self.status = 'D' return 9 case _: raise KeyError" "class Avtomat: state = 7 def lower(self): if self.state == 6: self.state = 9 elif self.state == 0: self.state = 1 elif self.state == 1: self.state = 3 else: raise KeyError return self.state def rock(self): if self.state == 3 or self.state == 5: self.state = 6 elif self.state == 6: self.state = 8 elif self.state == 1: self.state = 4 elif self.state == 8 or self.state == 4 or self.state == 11: self.state = 11 else: raise KeyError return self.state def sit(self): if self.state == 1: self.state = 2 elif self.state == 2 or self.state == 9: self.state = 5 elif self.state == 7: self.state = 0 elif self.state == 5 or self.state == 3: self.state = 7 elif self.state == 11 or self.state == 8 or self.state == 4: self.state = 10 else: raise KeyError return self.state def main(): return Avtomat()" "from enum import Enum class Milee: num = 0 A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 def fetch(self): if self.num == 0: self.num = 0 elif self.num == 2 or self.num == 7: self.num = 3 elif self.num == 3 or self.num == 8 or self.num == 5: self.num = 5 elif self.num == 4: self.num = 6 elif self.num == 6: self.num = 7 else: raise KeyError return self.num def pluck(self): if self.num == 0: self.num = 2 elif self.num == 0: self.num = 1 elif self.num == 3 or self.num == 8 or self.num == 5: self.num = 4 elif self.num == 6: self.num = 8 else: raise KeyError return self.num def main(): return Milee()" "class main: def __init__(self): self.pos = 'A' def color(self): if self.pos == 'A': return 1 if self.pos == 'C': self.pos = 'D' return 3 if self.pos == 'E': self.pos = 'A' return 6 if self.pos == 'F': return 8 raise KeyError() def etch(self): if self.pos == 'A': self.pos = 'B' return 0 if self.pos == 'B': self.pos = 'C' return 2 if self.pos == 'D': self.pos = 'E' return 4 if self.pos == 'E': self.pos = 'F' return 5 if self.pos == 'F': self.pos = 'D' return 7 raise KeyError()" "class main: class node: def __init__(self, left, right, leftData, rightData): self.left = left self.right = right self.leftData = leftData self.rightData = rightData def __init__(self): self.ar = [self.node(0, 1, 1, 0), self.node(2, 1, 2, 'KeyError'), self.node(3, 4, 3, 4), self.node(4, 3, 5, 6), self.node(4, 5, 'KeyError', 7), self.node(6, 5, 8, 'KeyError'), self.node(6, 6, 'KeyError', 9)] self.cur = 0 def etch(self): ans = self.ar[self.cur].leftData if ans == 'KeyError': raise KeyError self.cur = self.ar[self.cur].left return ans def tag(self): ans = self.ar[self.cur].rightData if ans == 'KeyError': raise KeyError self.cur = self.ar[self.cur].right return ans" "class main: def __init__(self): self.state = 'A' def stall(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'D': self.state = 'E' return 4 elif self.state == 'E': self.state = 'F' return 7 elif self.state == 'F': self.state = 'D' return 8 else: raise KeyError def reset(self): if self.state == 'B': self.state = 'C' return 1 elif self.state == 'C': self.state = 'F' return 3 elif self.state == 'D': return 5 else: raise KeyError def sway(self): if self.state == 'C': self.state = 'D' return 2 elif self.state == 'D': self.state = 'A' return 6 else: raise KeyError" "A = [[0, 1], [1, 0], [0, 'KeyError']] B = [[6, 3], [2, 2], [1, 'KeyError']] C = [[4, 5], [5, 6], [3, 4]] D = [[3, 'KeyError'], [3, 'KeyError'], [4, 7]] E = [[5, 8], [4, 'KeyError'], [4, 'KeyError']] F = [[5, 'KeyError'], [5, 'KeyError'], [5, 'KeyError']] sett = [A, B, C, D, E, F] class Mili: def __init__(self): self.state = A def play(self): buf = self.state if buf[0][1] == 'KeyError': raise KeyError('KeyError') else: self.state = sett[self.state[0][0]] return buf[0][1] def stare(self): buf = self.state if buf[1][1] == 'KeyError': raise KeyError('KeyError') else: self.state = sett[self.state[1][0]] return buf[1][1] def chat(self): buf = self.state if buf[2][1] == 'KeyError': raise KeyError('KeyError') else: self.state = sett[self.state[2][0]] return buf[2][1] def main(): return Mili()" "class main(object): def __init__(self): self.status = 'A' def warp(self): match self.status: case 'A': self.status = 'B' return 0 case 'C': self.status = 'F' return 5 case 'E': self.status = 'F' return 7 case 'F': self.status = 'G' return 8 case 'G': self.status = 'H' return 10 case _: raise KeyError def cut(self): match self.status: case 'B': self.status = 'C' return 1 case 'C': self.status = 'D' return 3 case 'D': self.status = 'E' return 6 case _: raise KeyError def stare(self): match self.status: case 'B': self.status = 'F' return 2 case 'C': self.status = 'E' return 4 case 'F': self.status = 'D' return 9 case 'H': self.status = 'F' return 11 case _: raise KeyError" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class main: currentPoint = State.A def step(self): return self.update({State.A: [State.C, 1], State.B: [State.C, 2], State.D: [State.E, 4], State.E: [State.E, 6]}) def forge(self): return self.update({State.A: [State.B, 0], State.C: [State.D, 3], State.E: [State.F, 5]}) def stay(self): return self.update({State.E: [State.C, 7], State.F: [State.C, 8]}) def update(self, map): current = map[self.currentPoint] self.currentPoint = current[0] return current[1]" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class main: currentPoint = State.A def stand(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 2], State.C: [State.F, 5], State.D: [State.E, 6]}) def shift(self): return self.update({State.A: [State.F, 1], State.B: [State.B, 3], State.C: [State.D, 4], State.E: [State.F, 7], State.F: [State.B, 8]}) def update(self, map): current = map[self.currentPoint] self.currentPoint = current[0] return current[1]" "class FSM: def __init__(self): self.current_state = 'A' self.transitions_cast = {'A': 0, 'B': 3, 'C': 6, 'D': -1, 'E': -1, 'F': -1} self.transitions_slip = {'A': -1, 'B': 2, 'C': 4, 'D': -1, 'E': -1, 'F': -1} self.transitions_base = {'A': 1, 'B': -1, 'C': 5, 'D': 7, 'E': 8, 'F': -1} def cast(self): ans = self.transitions_cast[self.current_state] if ans == 0: self.current_state = 'B' return ans elif ans == 3: self.current_state = 'D' return ans elif ans == 6: self.current_state = 'C' return ans else: raise KeyError def slip(self): ans = self.transitions_slip[self.current_state] if ans == 2: self.current_state = 'C' return ans elif ans == 4: self.current_state = 'D' return ans else: raise KeyError def base(self): ans = self.transitions_base[self.current_state] if ans == 1: self.current_state = 'E' return ans elif ans == 7: self.current_state = 'E' return ans elif ans == 5: self.current_state = 'F' return ans elif ans == 8: self.current_state = 'F' return ans else: raise KeyError def main(): o = FSM() return o" "class main: def __init__(self): self._cur_state = 'A' def scrub(self): if self._cur_state == 'A': self._cur_state = 'B' return 0 if self._cur_state == 'B': self._cur_state = 'C' return 1 if self._cur_state == 'C': self._cur_state = 'D' return 3 if self._cur_state == 'D': self._cur_state = 'E' return 4 if self._cur_state == 'E': self._cur_state = 'C' return 7 raise KeyError() def walk(self): if self._cur_state == 'B': self._cur_state = 'B' return 2 if self._cur_state == 'D': self._cur_state = 'D' return 5 if self._cur_state == 'F': self._cur_state = 'D' return 8 if self._cur_state == 'E': self._cur_state = 'F' return 6 raise KeyError()" "class main(object): def __init__(self): self.state = 'A' def post(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'D': self.state = 'E' return 5 elif self.state == 'E': self.state = 'B' return 7 else: raise KeyError def race(self): if self.state == 'B': return 3 elif self.state == 'C': self.state = 'D' return 4 else: raise KeyError def scan(self): if self.state == 'B': self.state = 'C' return 2 elif self.state == 'A': self.state = 'F' return 1 elif self.state == 'F': self.state = 'C' return 8 elif self.state == 'E': self.state = 'F' return 6 else: raise KeyError" "class Mili: state = 'A' def lower(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 1 elif self.state == 'C': return 4 elif self.state == 'D': self.state = 'F' return 6 elif self.state == 'F': self.state = 'G' return 8 elif self.state == 'E': self.state = 'F' return 7 else: raise KeyError def type(self): if self.state == 'C': self.state = 'D' return 3 elif self.state == 'D': self.state = 'E' return 5 elif self.state == 'B': self.state = 'G' return 2 elif self.state == 'G': self.state = 'A' return 9 else: raise KeyError def main(): return Mili()" "def main(): return mils() class mils: def __init__(self): self.state = 'A' def paste(self): match self.state: case 'A': self.state = 'B' return 0 case 'C': self.state = 'H' return 5 case 'D': self.state = 'E' return 6 case 'E': self.state = 'F' return 8 case 'G': self.state = 'H' return 10 case _: raise KeyError() def coat(self): match self.state: case 'A': self.state = 'D' return 1 case 'B': return 3 case 'C': self.state = 'D' return 4 case 'G': self.state = 'E' return 11 case _: raise KeyError() def hurry(self): match self.state: case 'B': self.state = 'C' return 2 case 'D': self.state = 'G' return 7 case 'F': self.state = 'G' return 9 case _: raise KeyError()" "class main: currentLetter = 'A' movementDrag = {'A': '1E', 'B': '2C', 'C': '4D', 'D': '5E', 'E': '6F', 'F': '8F'} movementWalk = {'A': '0B', 'B': '3F', 'E': '7C'} def drag(self): temp = self.currentLetter if self.movementDrag.get(temp, 'KeyError')[1] != 'e': self.currentLetter = self.movementDrag.get(temp, 'KeyError')[1] return int(self.movementDrag.get(temp)[0]) else: raise KeyError def walk(self): temp = self.currentLetter if self.movementWalk.get(temp, 'KeyError')[1] != 'e': self.currentLetter = self.movementWalk.get(temp, 'KeyError')[1] return int(self.movementWalk.get(temp)[0]) else: raise KeyError" "t_move = {'A': None, 'B': 2, 'C': None, 'D': None, 'E': 6, 'F': 7, 'G': None} t_drag = {'A': 0, 'B': 1, 'C': 3, 'D': 4, 'E': 5, 'F': 8, 'G': 9} b = ['B', 'C', 'E', 'D', 'E', 'F', 'G', 'G', 'D', 'B'] def main(): return A() class A: def __init__(self): self.cur_state = 'A' def drag(self): a = t_drag[self.cur_state] if a is not None: self.cur_state = b[a] return a else: raise KeyError def move(self): a = t_move[self.cur_state] if a: self.cur_state = b[a] return a else: raise KeyError" "class State: def __init__(self, capacities): self.capacities = capacities class Mili: def __init__(self): self.A = State({'walk': [0, None]}) self.B = State({'walk': [1, None]}) self.C = State({'walk': [2, None], 'fill': [3, None], 'mask': [4, None]}) self.D = State({'mask': [5, None]}) self.E = State({'walk': [6, None], 'mask': [7, None]}) self.F = State({'mask': [8, None]}) self.G = State({'walk': [9, None]}) self.A.capacities['walk'][1] = self.B self.B.capacities['walk'][1] = self.C self.C.capacities['walk'][1] = self.D self.C.capacities['fill'][1] = self.G self.C.capacities['mask'][1] = self.E self.D.capacities['mask'][1] = self.E self.E.capacities['walk'][1] = self.F self.E.capacities['mask'][1] = self.A self.F.capacities['mask'][1] = self.G self.G.capacities['walk'][1] = self.G self.initial_state = self.A def walk(self): if 'walk' not in self.initial_state.capacities: raise KeyError else: value = self.initial_state.capacities['walk'][0] self.initial_state = self.initial_state.capacities['walk'][1] return value def mask(self): if 'mask' not in self.initial_state.capacities: raise KeyError else: value = self.initial_state.capacities['mask'][0] self.initial_state = self.initial_state.capacities['mask'][1] return value def fill(self): if 'fill' not in self.initial_state.capacities: raise KeyError else: value = self.initial_state.capacities['fill'][0] self.initial_state = self.initial_state.capacities['fill'][1] return value def main(): graph = Mili() return graph" "class FSM: def __init__(self): self.state = 'a' def coat(self): if self.state == 'a': self.state = 'e' return 1 elif self.state == 'b': self.state = 'c' return 2 elif self.state == 'c': self.state = 'e' return 4 elif self.state == 'd': self.state = 'e' return 5 elif self.state == 'e': self.state = 'f' return 7 elif self.state == 'f': self.state = 'g' return 8 elif self.state == 'g': self.state = 'c' return 10 elif self.state == 'h': raise KeyError else: raise KeyError def post(self): if self.state == 'a': self.state = 'b' return 0 elif self.state == 'b': raise KeyError elif self.state == 'c': self.state = 'd' return 3 elif self.state == 'd': self.state = 'h' return 6 elif self.state == 'e': raise KeyError elif self.state == 'f': raise KeyError elif self.state == 'g': self.state = 'h' return 9 elif self.state == 'h': self.state = 'b' return 11 else: raise KeyError def main(): return FSM()" "def main(): class A: def __init__(self): self.rotates = {('A', 'trace'): ('A', 1), ('A', 'reset'): ('B', 0), ('B', 'reset'): ('C', 2), ('B', 'trace'): ('D', 3), ('C', 'reset'): ('D', 4), ('D', 'trace'): ('E', 5), ('D', 'reset'): ('F', 6), ('E', 'reset'): ('F', 7), ('E', 'trace'): ('A', 8)} self.state = 'A' def __rotate(self, path): if (self.state, path) not in self.rotates: raise KeyError('Rotate not found') rotate = self.rotates[self.state, path] self.state = rotate[0] return rotate[1] def trace(self): return self.__rotate('trace') def reset(self): return self.__rotate('reset') return A()" "class main: a = 0 sost = 'A' def apply(self): dict = {'A': [2, 'A'], 'B': [5, 'F'], 'C': KeyError, 'D': [7, 'E'], 'E': KeyError, 'F': KeyError} for (key, value) in dict.items(): if key == self.sost: if value == KeyError: raise KeyError else: self.a = value[0] self.sost = value[1] return self.a def blame(self): dict = {'A': [0, 'B'], 'B': [4, 'E'], 'C': [6, 'D'], 'D': KeyError, 'E': KeyError, 'F': KeyError} for (key, value) in dict.items(): if key == self.sost: if value == KeyError: raise KeyError else: self.a = value[0] self.sost = value[1] return self.a def sit(self): dict = {'A': [1, 'E'], 'B': [3, 'C'], 'C': KeyError, 'D': KeyError, 'E': [8, 'F'], 'F': KeyError} for (key, value) in dict.items(): if key == self.sost: if value == KeyError: raise KeyError else: self.a = value[0] self.sost = value[1] return self.a" "class main: node = 'A' nodes_dict = {'A': [{0: 'B'}, {1: 'C'}], 'B': [None, {2: 'C'}], 'C': [{3: 'D'}, None], 'D': [None, {4: 'E'}], 'E': [{6: 'A'}, {5: 'F'}], 'F': [{8: 'D'}, {7: 'A'}]} def __init__(self): self.node = 'A' def forge(self): temp = self.nodes_dict[self.node][0] if temp: (self.node,) = temp.values() (num,) = temp.keys() return num else: raise KeyError() def snap(self): temp = self.nodes_dict[self.node][1] if temp: (self.node,) = temp.values() (num,) = temp.keys() return num else: raise KeyError()" "class main: def __init__(self): self.pos = 'A' def add(self): if self.pos == 'A': self.pos = 'B' return 0 if self.pos == 'B': self.pos = 'F' return 2 if self.pos == 'C': self.pos = 'D' return 3 if self.pos == 'D': self.pos = 'G' return 6 if self.pos == 'G': self.pos = 'A' return 9 raise KeyError def trash(self): if self.pos == 'B': self.pos = 'C' return 1 if self.pos == 'C': self.pos = 'F' return 4 if self.pos == 'D': self.pos = 'E' return 5 if self.pos == 'E': self.pos = 'F' return 7 if self.pos == 'F': self.pos = 'G' return 8 raise KeyError" "class Node: def __init__(self): self.data = None self.status = 'A' def func_menu(self, func): if func == 'fork': return self.fork() elif func == 'brake': return self.brake() elif func == 'paste': return self.paste() def fork(self): if self.status == 'A': self.data = 0 self.status = 'B' elif self.status == 'B': self.data = 3 self.status = 'C' elif self.status == 'D': self.data = 6 self.status = 'E' elif self.status == 'E': self.data = 7 self.status = 'F' elif self.status == 'F': self.data = 10 self.status = 'D' else: raise KeyError return self.data def brake(self): if self.status == 'B': self.data = 4 self.status = 'B' elif self.status == 'A': self.data = 2 self.status = 'H' elif self.status == 'E': self.data = 8 self.status = 'G' elif self.status == 'G': self.data = 11 self.status = 'H' else: raise KeyError return self.data def paste(self): if self.status == 'C': self.data = 5 self.status = 'D' elif self.status == 'A': self.data = 1 self.status = 'E' elif self.status == 'F': self.data = 9 self.status = 'G' else: raise KeyError return self.data def main(): return Node()" "class main: point = str() def clone(self): if self.point == 'A': self.point = 'E' return 1 elif self.point == 'B': self.point = 'F' return 3 elif self.point == 'F': self.point = 'A' return 8 elif self.point == 'D': self.point = 'E' return 5 else: raise KeyError() def check(self): if self.point == 'A': self.point = 'B' return 0 elif self.point == 'B': self.point = 'C' return 2 elif self.point == 'C': self.point = 'D' return 4 elif self.point == 'D': self.point = 'B' return 6 elif self.point == 'E': self.point = 'F' return 7 else: raise KeyError() def __init__(self): self.point = 'A'" "amblem = (0, 5, 7, 8, 11, 3) etchm = (1, 2, 4, 6, 9, 10) arr = {-1: [0, 1], 0: [2, 3], 1: [9], 2: [4, 5], 3: [10, 11], 4: [6, 7], 5: [5, 4], 6: [8], 7: [6, 7], 8: [9], 9: [10, 11], 10: [-2], 11: [4, 5]} class mymain: def __init__(self): self.n = -1 def amble(self): for i in arr.get(self.n): if i in amblem: self.n = i return i raise KeyError def etch(self): for i in arr.get(self.n): if i in etchm: self.n = i return i raise KeyError def main(): return mymain()" "jogm = [0, 6, 11] drawm = [1, 2, 3, 7, 9] trashm = [4, 8, 10] patchm = [5] arr = {-1: [0, 1], 0: [2], 1: [5], 2: [3, 4], 3: [5], 4: [7, 6, 8], 5: [7, 6, 8], 6: [9], 7: [2], 8: [0, 1], 9: [10, 11], 10: [-2], 11: [2]} class Mili: def __init__(self): self.n = -1 def jog(self): for i in arr.get(self.n): if i in jogm: self.n = i return i raise KeyError def draw(self): for i in arr.get(self.n): if i in drawm: self.n = i return i raise KeyError def trash(self): for i in arr.get(self.n): if i in trashm: self.n = i return i raise KeyError def patch(self): for i in arr.get(self.n): if i in patchm: self.n = i return i raise KeyError def main(): return Mili()" "import enum class MilliState(enum.Enum): STATE_A = 0 STATE_B = 1 STATE_C = 2 STATE_D = 3 STATE_E = 4 STATE_F = 5 STATE_G = 6 class Milli: def __init__(self, state): self._state = state def crawl(self): if self._state == MilliState.STATE_A: self._state = MilliState.STATE_B return 0 elif self._state == MilliState.STATE_B: self._state = MilliState.STATE_B return 2 elif self._state == MilliState.STATE_D: self._state = MilliState.STATE_E return 4 elif self._state == MilliState.STATE_E: self._state = MilliState.STATE_F return 6 elif self._state == MilliState.STATE_F: self._state = MilliState.STATE_G return 7 else: raise KeyError def type(self): if self._state == MilliState.STATE_B: self._state = MilliState.STATE_C return 1 elif self._state == MilliState.STATE_C: self._state = MilliState.STATE_D return 3 elif self._state == MilliState.STATE_D: self._state = MilliState.STATE_F return 5 elif self._state == MilliState.STATE_F: self._state = MilliState.STATE_F return 8 elif self._state == MilliState.STATE_G: self._state = MilliState.STATE_D return 9 else: raise KeyError def main(): return Milli(MilliState.STATE_A)" "class main: def __init__(self): self.n = 'A' def close(self): if self.n == 'A': self.n = 'B' return 0 if self.n == 'C': self.n = 'D' return 2 if self.n == 'E': self.n = 'A' return 7 else: raise KeyError def apply(self): if self.n == 'B': self.n = 'C' return 1 if self.n == 'E': self.n = 'F' return 5 if self.n == 'F': self.n = 'G' return 9 else: raise KeyError def open(self): if self.n == 'C': self.n = 'E' return 3 if self.n == 'E': self.n = 'G' return 6 else: raise KeyError def pan(self): if self.n == 'E': self.n = 'B' return 8 if self.n == 'D': self.n = 'E' return 4 else: raise KeyError" "class main: def __init__(self): self.name = 'A' def snap(self): if self.name == 'A': self.name = 'B' return 0 elif self.name == 'D': self.name = 'E' return 4 elif self.name == 'E': return 7 else: raise KeyError def march(self): if self.name == 'B': self.name = 'C' return 2 elif self.name == 'D': return 5 elif self.name == 'E': self.name = 'C' return 8 else: raise KeyError def cue(self): if self.name == 'A': self.name = 'E' return 1 elif self.name == 'C': self.name = 'D' return 3 elif self.name == 'E': self.name = 'F' return 6 else: raise KeyError" "class mili: def __init__(self): self.states = {'A': [('B', 0), ('D', 1)], 'B': [('C', 2), ''], 'C': [('D', 3), ''], 'D': [('E', 4), ('B', 5)], 'E': [('F', 6), ('C', 7)], 'F': ['', ('C', 8)]} self.state = 'A' self.num = 0 def step(self): state1 = self.states[self.state][1] if isinstance(state1, str): raise KeyError else: self.state = state1[0] return state1[1] def stop(self): state1 = self.states[self.state][0] if isinstance(state1, str): raise KeyError else: self.state = state1[0] return state1[1] def main(): return mili()" "class main1: status = '' def __init__(self): self.status = 'A' def peep(self): if self.status == 'A': self.status = 'B' return 0 if self.status == 'E': self.status = 'H' return 6 if self.status == 'G': self.status = 'H' return 9 else: raise KeyError def chat(self): if self.status == 'B': self.status = 'C' return 1 if self.status == 'C': self.status = 'D' return 2 if self.status == 'D': self.status = 'E' return 4 if self.status == 'E': self.status = 'F' return 5 if self.status == 'F': self.status = 'C' return 8 if self.status == 'G': self.status = 'D' return 11 else: raise KeyError def rush(self): if self.status == 'C': self.status = 'E' return 3 else: raise KeyError def push(self): if self.status == 'F': self.status = 'G' return 7 if self.status == 'G': self.status = 'E' return 10 else: raise KeyError def main(): return main1()" "class mili: def __init__(self): self.states = {'A': [('B', 0), ('F', 1)], 'B': [('C', 2), ''], 'C': [('D', 3), ''], 'D': [('B', 5), ('E', 4)], 'E': [('C', 7), ('F', 6)], 'F': [('C', 8), '']} self.state = 'A' self.num = 0 def unite(self): state1 = self.states[self.state][1] if isinstance(state1, str): raise KeyError else: self.state = state1[0] return state1[1] def amble(self): state1 = self.states[self.state][0] if isinstance(state1, str): raise KeyError else: self.state = state1[0] return state1[1] def main(): return mili()" "class main: state = 'A' def open(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 2 elif self.state == 'C': self.state = 'D' return 3 elif self.state == 'D': self.state = 'F' return 6 elif self.state == 'E': self.state = 'F' return 7 raise KeyError pass def throw(self): if self.state == 'A': self.state = 'E' return 1 elif self.state == 'C': self.state = 'C' return 4 elif self.state == 'D': self.state = 'E' return 5 elif self.state == 'E': self.state = 'E' return 8 elif self.state == 'F': self.state = 'G' return 9 raise KeyError pass o = main()" "class Gun: def __init__(self): self.pos = 'A' def mix(self): d = dict(A=('A', 2), C=('D', 5), E=('E', 8)) (self.pos, val) = d[self.pos] return val def reset(self): d = dict(A=('B', 0), B=('C', 3), E=('F', 7)) (self.pos, val) = d[self.pos] return val def roam(self): d = dict(B=('B', 4), A=('D', 1), D=('E', 6)) (self.pos, val) = d[self.pos] return val def main(): return Gun()" "class Gum: def __init__(self): self.pos = 'A' def amble(self): d = dict(A=('B', 0), C=('A', 5), B=('H', 3), F=('G', 8), D=('E', 6)) (self.pos, val) = d[self.pos] return val def add(self): d = dict(A=('D', 1), C=('D', 4), B=('C', 2), F=('B', 9), E=('F', 7), H=('F', 11), G=('H', 10)) (self.pos, val) = d[self.pos] return val def main(): return Gum()" "putm = (0, 7, 9, 11) scanm = (1, 5) drawm = (3, 4, 8, 10) skewm = (2, 6) arr = {-1: [0], 0: [1, 2, 3], 1: [4, 5], 2: [1, 2, 3], 3: [9], 4: [6], 5: [0], 6: [7, 8], 7: [9], 8: [1, 2, 3], 9: [10, 11], 10: [-2], 11: [1, 2, 3]} class mymain: def __init__(self): self.n = -1 def put(self): for i in arr.get(self.n): if i in putm: self.n = i return i raise KeyError def scan(self): for i in arr.get(self.n): if i in scanm: self.n = i return i raise KeyError def draw(self): for i in arr.get(self.n): if i in drawm: self.n = i return i raise KeyError def skew(self): for i in arr.get(self.n): if i in skewm: self.n = i return i raise KeyError def main(): return mymain()" "class Gum: def __init__(self): self.pos = 'A' def fetch(self): d = dict(A=('A', 1), C=('D', 3), E=('E', 7), D=('B', 5)) (self.pos, val) = d[self.pos] return val def shift(self): d = dict(A=('B', 0), B=('C', 2), D=('E', 4), F=('G', 8), E=('F', 6), G=('G', 9)) (self.pos, val) = d[self.pos] return val def main(): return Gum()" "class main: def __init__(self): self.state = 'A' def amble(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 2 elif self.state == 'D': self.state = 'E' return 5 elif self.state == 'F': self.state = 'C' return 8 elif self.state == 'G': self.state = 'C' return 9 else: raise KeyError() def cut(self): if self.state == 'A': self.state = 'G' return 1 elif self.state == 'B': self.state = 'D' return 3 elif self.state == 'C': self.state = 'D' return 4 elif self.state == 'E': self.state = 'F' return 6 elif self.state == 'F': self.state = 'G' return 7 else: raise KeyError()" "class Mile: current_state = 'A' def race(self): if self.current_state == 'A': self.current_state = 'B' return 0 elif self.current_state == 'B': self.current_state = 'F' return 4 elif self.current_state == 'C': self.current_state = 'D' return 5 elif self.current_state == 'F': self.current_state = 'G' return 8 elif self.current_state == 'G': self.current_state = 'H' return 10 else: raise KeyError def link(self): if self.current_state == 'B': return 3 elif self.current_state == 'A': self.current_state = 'H' return 1 elif self.current_state == 'G': self.current_state = 'D' return 11 else: raise KeyError def snap(self): if self.current_state == 'B': self.current_state = 'C' return 2 elif self.current_state == 'F': self.current_state = 'A' return 9 elif self.current_state == 'D': self.current_state = 'E' return 6 elif self.current_state == 'E': self.current_state = 'F' return 7 else: raise KeyError def main(): o = Mile() return o" "class Task9: def __init__(self): self.state = 'A' def rig(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'C': self.state = 'D' return 3 elif self.state == 'E': self.state = 'G' return 6 else: raise KeyError def stand(self): if self.state == 'B': self.state = 'C' return 1 elif self.state == 'F': self.state = 'G' return 7 elif self.state == 'E': self.state = 'F' return 5 else: raise KeyError def clone(self): if self.state == 'B': self.state = 'E' return 2 elif self.state == 'F': self.state = 'D' return 8 elif self.state == 'D': self.state = 'E' return 4 elif self.state == 'G': self.state = 'B' return 9 else: raise KeyError def main(): return Task9()" "class main(object): state = 'A' def __init__(self): pass def chat(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 2 elif self.state == 'C': self.state = 'D' return 4 elif self.state == 'D': self.state = 'E' return 5 elif self.state == 'E': self.state = 'A' return 7 elif self.state == 'F': self.state = 'F' return 9 else: raise KeyError def crack(self): if self.state == 'B': self.state = 'E' return 3 elif self.state == 'E': self.state = 'F' return 6 elif self.state == 'F': self.state = 'G' return 8 else: raise KeyError def chain(self): if self.state == 'A': self.state = 'F' return 1 else: raise KeyError" "class main(object): state = 'A' def __init__(self): pass def march(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'E': self.state = 'F' return 7 elif self.state == 'F': self.state = 'G' return 9 else: raise KeyError def slur(self): if self.state == 'A': self.state = 'C' return 2 elif self.state == 'B': self.state = 'C' return 3 elif self.state == 'C': self.state = 'D' return 5 elif self.state == 'D': self.state = 'E' return 6 elif self.state == 'E': self.state = 'G' return 8 else: raise KeyError def code(self): if self.state == 'A': self.state = 'F' return 1 if self.state == 'B': self.state = 'F' return 4 else: raise KeyError" "class main: def __init__(self): self.condition = 'A' def split(self): if self.condition == 'A': self.condition = 'B' return 0 elif self.condition == 'E': self.condition = 'F' return 6 elif self.condition == 'H': self.condition = 'D' return 11 else: raise KeyError def melt(self): if self.condition == 'A': self.condition = 'H' return 1 elif self.condition == 'C': self.condition = 'D' return 3 elif self.condition == 'D': self.condition = 'E' return 5 elif self.condition == 'F': self.condition = 'D' return 9 else: raise KeyError def zoom(self): if self.condition == 'B': self.condition = 'C' return 2 elif self.condition == 'C': self.condition = 'A' return 4 elif self.condition == 'E': self.condition = 'E' return 7 elif self.condition == 'F': self.condition = 'G' return 8 elif self.condition == 'G': self.condition = 'H' return 10 else: raise KeyError" "import enum class MilliState(enum.Enum): STATE_A = 0 STATE_B = 1 STATE_C = 2 STATE_D = 3 STATE_E = 4 STATE_F = 5 STATE_G = 6 STATE_H = 7 class Milli: def __init__(self, state): self._state = state def skip(self): if self._state == MilliState.STATE_A: self._state = MilliState.STATE_B return 0 elif self._state == MilliState.STATE_B: self._state = MilliState.STATE_C return 1 elif self._state == MilliState.STATE_C: self._state = MilliState.STATE_D return 3 elif self._state == MilliState.STATE_D: self._state = MilliState.STATE_E return 4 elif self._state == MilliState.STATE_E: self._state = MilliState.STATE_F return 6 elif self._state == MilliState.STATE_G: self._state = MilliState.STATE_H return 9 else: raise KeyError def crack(self): if self._state == MilliState.STATE_B: self._state = MilliState.STATE_F return 2 elif self._state == MilliState.STATE_F: self._state = MilliState.STATE_G return 8 elif self._state == MilliState.STATE_G: self._state = MilliState.STATE_E return 10 elif self._state == MilliState.STATE_D: self._state = MilliState.STATE_H return 5 elif self._state == MilliState.STATE_E: self._state = MilliState.STATE_C return 7 elif self._state == MilliState.STATE_H: self._state = MilliState.STATE_B return 11 else: raise KeyError def main(): return Milli(MilliState.STATE_A)" "class A: def __init__(self): self.state = 'A' def amble(self): match self.state: case 'A': self.state = 'B' return 0 case 'B': self.state = 'C' return 1 case 'C': self.state = 'G' return 5 case 'D': self.state = 'E' return 6 case 'G': self.state = 'H' return 10 case _: raise KeyError def peek(self): match self.state: case 'C': self.state = 'D' return 3 case 'F': self.state = 'G' return 9 case 'H': self.state = 'E' return 11 case _: raise KeyError def slog(self): match self.state: case 'B': self.state = 'F' return 2 case 'C': self.state = 'F' return 4 case 'D': return 7 case 'E': self.state = 'F' return 8 case _: raise KeyError def main(): return A()" "import re class main: now_letter = 'A' slov_brake = {'A': '0B', 'B': '5G', 'C': '6D', 'E': '9H', 'F': '10G'} slov_melt = {'A': '2C', 'B': '3C', 'E': '8F'} slov_group = {'A': '1D', 'B': '4D', 'D': '7E', 'G': '11H'} def brake(self): temp_brake = self.now_letter num = '' letter = '' if self.slov_brake.get(temp_brake, 'KeyError')[1] != 'e': let = re.findall('\\D', self.slov_brake.get(temp_brake, 'KeyError')) for e in let: letter += str(e) self.now_letter = letter number = re.findall('\\d', self.slov_brake.get(temp_brake)) for e in number: num += str(e) return int(num) else: raise KeyError def melt(self): temp_melt = self.now_letter num = '' letter = '' if self.slov_melt.get(temp_melt, 'KeyError')[1] != 'e': let = re.findall('\\D', self.slov_melt.get(temp_melt, 'KeyError')) for e in let: letter += str(e) self.now_letter = letter number = re.findall('\\d', self.slov_melt.get(temp_melt)) for e in number: num += str(e) return int(num) else: raise KeyError def group(self): temp_group = self.now_letter num = '' letter = '' if self.slov_group.get(temp_group, 'KeyError')[1] != 'e': let = re.findall('\\D', self.slov_group.get(temp_group, 'KeyError')) for e in let: letter += str(e) self.now_letter = letter number = re.findall('\\d', self.slov_group.get(temp_group)) for e in number: num += str(e) return int(num) else: raise KeyError" "class Mili: def __init__(self): self.state = 'A' def skew(self): if self.state == 'B': self.state = 'C' return 1 elif self.state == 'C': self.state = 'D' return 2 elif self.state == 'D': self.state = 'E' return 3 elif self.state == 'F': self.state = 'G' return 6 else: raise KeyError def melt(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'E': self.state = 'C' return 5 elif self.state == 'F': self.state = 'D' return 7 elif self.state == 'G': self.state = 'A' return 9 else: raise KeyError def zoom(self): if self.state == 'E': self.state = 'F' return 4 elif self.state == 'F': self.state = 'B' return 8 else: raise KeyError def main(): return Mili()" "class main: now_letter = 'A' slov_shift = {'A': '0B', 'B': '2C', 'C': '4D', 'D': '5E'} slov_leer = {'A': '1D', 'B': '3D', 'D': '6D', 'E': '7F', 'F': '8B'} def shift(self): temp_shift = self.now_letter if self.slov_shift.get(temp_shift, 'KeyError')[1] != 'e': self.now_letter = self.slov_shift.get(temp_shift, 'KeyError')[1] return int(self.slov_shift.get(temp_shift)[0]) else: raise KeyError def leer(self): temp_leer = self.now_letter if self.slov_leer.get(temp_leer, 'KeyError')[1] != 'e': self.now_letter = self.slov_leer.get(temp_leer, 'KeyError')[1] return int(self.slov_leer.get(temp_leer)[0]) else: raise KeyError" "from abc import ABC, abstractmethod class P(ABC): @abstractmethod def move(self, current) -> int: pass @abstractmethod def turn(self, current) -> int: pass class A(P): def move(self, current) -> int: current.current = B() return 0 def turn(self, current) -> int: current.current = A() return 1 class B(P): def move(self, current) -> int: current.current = C() return 2 def turn(self, current) -> int: current.current = D() return 3 class C(P): def move(self, current) -> int: raise KeyError() def turn(self, current) -> int: current.current = D() return 4 class D(P): def move(self, current) -> int: current.current = E() return 5 def turn(self, current) -> int: raise KeyError() class E(P): def move(self, current) -> int: current.current = A() return 7 def turn(self, current) -> int: current.current = F() return 6 class F(P): def move(self, current) -> int: raise KeyError() def turn(self, current) -> int: return 8 class FiniteStateMachine: def __init__(self) -> None: self.current = A() def move(self) -> int: return self.current.move(self) def turn(self) -> int: return self.current.turn(self) def main() -> FiniteStateMachine: return FiniteStateMachine()" "tweakm = [0, 3, 4, 6, 8] scanm = [1, 2, 5, 7, 9] arr = {-1: [0, 1], 0: [2, 3], 1: [-2], 2: [4, 5], 3: [7, 8], 4: [6], 5: [-2], 6: [7, 8], 7: [9], 8: [-2], 9: [-2]} class Mili: def __init__(self): self.n = -1 def tweak(self): for i in arr.get(self.n): if i in tweakm: self.n = i return i raise KeyError def scan(self): for i in arr.get(self.n): if i in scanm: self.n = i return i raise KeyError def main(): return Mili()" "class StateMachine: state = 'A' def wreck(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 1 elif self.state == 'D': self.state = 'E' return 5 elif self.state == 'E': self.state = 'F' return 7 else: raise KeyError def etch(self): if self.state == 'C': self.state = 'D' return 3 elif self.state == 'B': self.state = 'D' return 2 elif self.state == 'D': self.state = 'A' return 6 elif self.state == 'F': self.state = 'D' return 8 else: raise KeyError def tread(self): if self.state == 'C': self.state = 'E' return 4 else: raise KeyError def main(): return StateMachine()" "class Mile: def __init__(self): self.place = 'a' def skip(self): if self.place == 'a': self.place = 'b' return 0 if self.place == 'b': self.place = 'c' return 1 if self.place == 'c': self.place = 'f' return 3 if self.place == 'g': self.place = 'b' return 9 if self.place == 'f': self.place = 'b' return 7 else: raise KeyError def paint(self): if self.place == 'c': self.place = 'd' return 2 if self.place == 'd': self.place = 'e' return 4 if self.place == 'f': self.place = 'g' return 6 if self.place == 'e': self.place = 'f' return 5 if self.place == 'g': return 8 else: raise KeyError def main(): return Mile()" "class Milly: def __init__(self): self.status = 'A' def post(self): if self.status == 'A': return 1 if self.status == 'D': self.status = 'E' return 4 if self.status == 'E': self.status = 'F' return 6 if self.status == 'F': self.status = 'G' return 8 raise KeyError def fork(self): if self.status == 'A': self.status = 'B' return 0 if self.status == 'B': self.status = 'C' return 2 if self.status == 'F': return 9 raise KeyError def mute(self): if self.status == 'C': self.status = 'D' return 3 if self.status == 'E': self.status = 'B' return 7 if self.status == 'D': self.status = 'G' return 5 raise KeyError def main() -> Milly(): return Milly()" "class StateMachine: state = 'A' def chain(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'C': self.state = 'E' return 4 elif self.state == 'E': self.state = 'F' return 6 elif self.state == 'F': self.state = 'G' return 8 elif self.state == 'G': self.state = 'E' return 11 else: raise KeyError def place(self): if self.state == 'A': self.state = 'G' return 1 elif self.state == 'B': self.state = 'C' return 2 elif self.state == 'C': self.state = 'D' return 3 elif self.state == 'D': self.state = 'E' return 5 elif self.state == 'E': self.state = 'H' return 7 elif self.state == 'G': self.state = 'H' return 10 elif self.state == 'F': self.state = 'B' return 9 else: raise KeyError def main(): return StateMachine()" "import re class main: now_letter = 'A' dict_forge = {'A': '1A', 'F': '8C', 'H': '11E'} dict_cast = {'A': '0B', 'E': '6A', 'B': '2C'} dict_open = {'C': '3D', 'D': '4E', 'E': '5F', 'G': '9H'} dict_crawl = {'G': '10B', 'F': '7G'} def forge(self): temp_forge = self.now_letter if temp_forge in self.dict_forge: self.now_letter = re.findall('[A-Z]', self.dict_forge.get(temp_forge, 'KeyError'))[0] return int(re.findall('[0-9]+', self.dict_forge.get(temp_forge, 'KeyError'))[0]) else: raise KeyError def cast(self): temp_cast = self.now_letter if temp_cast in self.dict_cast: self.now_letter = re.findall('[A-Z]', self.dict_cast.get(temp_cast, 'KeyError'))[0] return int(re.findall('[0-9]+', self.dict_cast.get(temp_cast, 'KeyError'))[0]) else: raise KeyError def open(self): temp_open = self.now_letter if temp_open in self.dict_open: self.now_letter = re.findall('[A-Z]', self.dict_open.get(temp_open, 'KeyError'))[0] return int(re.findall('[0-9]+', self.dict_open.get(temp_open, 'KeyError'))[0]) else: raise KeyError def crawl(self): temp_crawl = self.now_letter if temp_crawl in self.dict_crawl: self.now_letter = re.findall('[A-Z]', self.dict_crawl.get(temp_crawl, 'KeyError'))[0] return int(re.findall('[0-9]+', self.dict_crawl.get(temp_crawl, 'KeyError'))[0]) else: raise KeyError" "class FSM: def __init__(self): self.A = 'A' self.B = 'B' self.C = 'C' self.D = 'D' self.E = 'E' self.F = 'F' self.G = 'G' self.start = self.A self.current_state = self.start def pluck(self): if self.current_state == self.A: self.current_state = self.B return 0 if self.current_state == self.B: self.current_state = self.C return 1 elif self.current_state == self.C: self.current_state = self.D return 2 elif self.current_state == self.D: self.current_state = self.E return 4 elif self.current_state == self.F: self.current_state = self.C return 8 elif self.current_state == self.G: self.current_state = self.G return 9 else: raise KeyError def post(self): if self.current_state == self.C: self.current_state = self.A return 3 elif self.current_state == self.D: self.current_state = self.A return 5 elif self.current_state == self.E: self.current_state = self.F return 6 elif self.current_state == self.F: self.current_state = self.G return 7 else: raise KeyError def main(): evaluator = FSM() return evaluator" "class Miles_FSM: def __init__(self): self.state = 'A' def stop(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'E': self.state = 'A' return 6 elif self.state == 'F': self.state = 'G' return 7 elif self.state == 'G': self.state = 'H' return 9 elif self.state == 'H': self.state = 'F' return 10 else: raise KeyError def run(self): if self.state == 'B': self.state = 'C' return 1 elif self.state == 'C': self.state = 'D' return 2 elif self.state == 'D': self.state = 'E' return 3 elif self.state == 'E': self.state = 'F' return 5 elif self.state == 'F': self.state = 'A' return 8 else: raise KeyError def race(self): if self.state == 'D': self.state = 'H' return 4 elif self.state == 'H': self.state = 'A' return 11 else: raise KeyError def main(): obj = Miles_FSM() return obj" "class Miles_FSM: def __init__(self): self.state = 'A' def rev(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'D' return 4 elif self.state == 'F': self.state = 'G' return 8 elif self.state == 'G': self.state = 'H' return 10 else: raise KeyError def make(self): if self.state == 'B': self.state = 'B' return 3 elif self.state == 'C': self.state = 'D' return 5 elif self.state == 'E': self.state = 'F' return 7 else: raise KeyError def visit(self): if self.state == 'B': self.state = 'C' return 2 elif self.state == 'D': self.state = 'E' return 6 elif self.state == 'F': self.state = 'B' return 9 elif self.state == 'G': self.state = 'B' return 11 elif self.state == 'A': self.state = 'G' return 1 else: raise KeyError def main(): obj = Miles_FSM() return obj" "class Miles_FSM: def __init__(self): self.state = 'A' def look(self): if self.state == 'A': return 1 elif self.state == 'C': self.state = 'D' return 3 elif self.state == 'D': return 5 elif self.state == 'E': self.state = 'F' return 6 elif self.state == 'F': self.state = 'G' return 7 elif self.state == 'G': self.state = 'E' return 9 else: raise KeyError def rock(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 2 elif self.state == 'D': self.state = 'E' return 4 elif self.state == 'G': self.state = 'A' return 8 else: raise KeyError def main(): obj = Miles_FSM() return obj" "class FSM: def __init__(self): self.A = 'A' self.B = 'B' self.C = 'C' self.D = 'D' self.E = 'E' self.F = 'F' self.start = self.A self.current_state = self.start def fetch(self): if self.current_state == self.B: self.current_state = self.B return 2 elif self.current_state == self.D: self.current_state = self.E return 4 elif self.current_state == self.F: self.current_state = self.B return 7 else: raise KeyError def shade(self): if self.current_state == self.A: self.current_state = self.B return 0 elif self.current_state == self.B: self.current_state = self.C return 1 elif self.current_state == self.C: self.current_state = self.D return 3 elif self.current_state == self.D: self.current_state = self.B return 5 elif self.current_state == self.F: self.current_state = self.A return 8 elif self.current_state == self.E: self.current_state = self.F return 6 else: raise KeyError def main(): evaluator = FSM() return evaluator" "from abc import ABC, abstractmethod class P(ABC): @abstractmethod def herd(self, value): pass @abstractmethod def step(self, value): pass @abstractmethod def fork(self, value): pass class A(P): def herd(self, value): value.value = A() return 1 def step(self, value): value.value = B() return 0 def fork(self, value): raise KeyError() class B(P): def herd(self, value): value.value = C() return 2 def step(self, value): raise KeyError() def fork(self, value): raise KeyError class C(P): def herd(self, value): value.value = D() return 3 def step(self, value): raise KeyError() def fork(self, value): raise KeyError class D(P): def herd(self, value): raise KeyError() def step(self, value): value.value = E() return 4 def fork(self, value): raise KeyError class E(P): def herd(self, value): value.value = F() return 5 def step(self, value): value.value = B() return 7 def fork(self, value): value.value = E() return 6 class F(P): def herd(self, value): value.value = D() return 8 def step(self, value): raise KeyError() def fork(self, value): raise KeyError class FSM: def __init__(self): self.value = A() def herd(self): return self.value.herd(self) def step(self): return self.value.step(self) def fork(self): return self.value.fork(self) def main(): return FSM()" "class main: a = 0 sost = 'A' def etch(self): dict = {'A': [0, 'B'], 'B': KeyError, 'C': [4, 'D'], 'D': KeyError, 'E': [9, 'F'], 'F': [10, 'G'], 'G': KeyError, 'H': KeyError} for (key, value) in dict.items(): if key == self.sost: if value == KeyError: raise KeyError else: self.a = value[0] self.sost = value[1] return self.a def model(self): dict = {'A': [1, 'D'], 'B': [3, 'C'], 'C': [6, 'F'], 'D': [8, 'F'], 'E': KeyError, 'F': KeyError, 'G': [11, 'H'], 'H': KeyError} for (key, value) in dict.items(): if key == self.sost: if value == KeyError: raise KeyError else: self.a = value[0] self.sost = value[1] return self.a def debug(self): dict = {'A': [2, 'G'], 'B': KeyError, 'C': [5, 'A'], 'D': [7, 'E'], 'E': KeyError, 'F': KeyError, 'G': KeyError, 'H': KeyError} for (key, value) in dict.items(): if key == self.sost: if value == KeyError: raise KeyError else: self.a = value[0] self.sost = value[1] return self.a" "class main: def __init__(self): self.n = 'A' def walk(self): if self.n == 'A': self.n = 'A' return 1 if self.n == 'B': self.n = 'C' return 2 if self.n == 'C': self.n = 'D' return 3 if self.n == 'D': self.n = 'E' return 4 if self.n == 'E': self.n = 'F' return 6 if self.n == 'G': self.n = 'H' return 11 else: raise KeyError def amass(self): if self.n == 'A': self.n = 'B' return 0 if self.n == 'D': self.n = 'B' return 5 if self.n == 'E': self.n = 'E' return 8 if self.n == 'F': self.n = 'C' return 10 else: raise KeyError def hike(self): if self.n == 'E': self.n = 'C' return 7 if self.n == 'F': self.n = 'G' return 9 else: raise KeyError" "def main(): class Mily: def __init__(self): self._status = 'A' def file(self): if self._status == 'A': self._status = 'B' return 0 elif self._status == 'B': self._status = 'E' return 2 elif self._status == 'D': self._status = 'B' return 6 else: raise KeyError() def loop(self): if self._status == 'D': return 5 else: raise KeyError() def tread(self): if self._status == 'B': self._status = 'C' return 1 elif self._status == 'C': self._status = 'D' return 3 elif self._status == 'D': self._status = 'E' return 4 elif self._status == 'E': self._status = 'F' return 7 elif self._status == 'F': self._status = 'D' return 8 else: raise KeyError() return Mily()" "class main: def __init__(self): self.state = 'A' def post(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 2 elif self.state == 'D': self.state = 'E' return 4 elif self.state == 'E': self.state = 'F' return 6 else: raise KeyError def stay(self): if self.state == 'A': self.state = 'E' return 1 elif self.state == 'E': self.state = 'C' return 8 elif self.state == 'C': self.state = 'D' return 3 elif self.state == 'D': self.state = 'F' return 5 else: raise KeyError def slur(self): if self.state == 'E': self.state = 'B' return 7 else: raise KeyError" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def chain(self): return self.update({State.A: [State.A, 1], State.B: [State.C, 2], State.C: [State.E, 5], State.D: [State.H, 7], State.F: [State.G, 9], State.G: [State.H, 11]}) def code(self): return self.update({State.A: [State.B, 0], State.C: [State.D, 4], State.D: [State.E, 6], State.E: [State.F, 8], State.F: [State.H, 10], State.B: [State.G, 3]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def visit(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 1], State.C: [State.C, 4], State.D: [State.F, 6], State.E: [State.F, 7], State.F: [State.G, 9], State.G: [State.H, 10]}) def widen(self): return self.update({State.B: [State.D, 2], State.C: [State.D, 3], State.D: [State.E, 5], State.E: [State.H, 8], State.G: [State.D, 11]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main: def __init__(self): self.status = 'A' def spin(self): match self.status: case 'A': self.status = 'B' return 0 case 'F': return 8 case 'D': self.status = 'A' return 6 case _: raise KeyError def hoard(self): match self.status: case 'B': self.status = 'C' return 3 case 'A': return 2 case 'E': self.status = 'F' return 7 case _: raise KeyError def draw(self): match self.status: case 'A': self.status = 'F' return 1 case 'D': self.status = 'E' return 5 case 'C': self.status = 'D' return 4 case _: raise KeyError" "class States: A = list() B = list() C = list() D = list() E = list() F = list() G = list() class StateMachine: state = States.A def __init__(self): States.A.append(('trash', 0, States.B)) States.A.append(('crush', 2, States.F)) States.A.append(('log', 1, States.G)) States.B.append(('trash', 3, States.C)) States.C.append(('trash', 4, States.D)) States.D.append(('log', 6, States.B)) States.D.append(('crush', 5, States.E)) States.E.append(('log', 8, States.E)) States.E.append(('trash', 7, States.F)) States.F.append(('crush', 9, States.G)) def __get_next_node(self, method_name): found = None for node in self.state: if node[0] == method_name: found = node break return found def base_method(self, next_state): if next_state is not None: self.state = next_state[2] return next_state[1] else: raise KeyError('No such edge!') def trash(self): next_state = self.__get_next_node('trash') return self.base_method(next_state) def crush(self): next_state = self.__get_next_node('crush') return self.base_method(next_state) def log(self): next_state = self.__get_next_node('log') return self.base_method(next_state) def main(): return StateMachine()" "class main: condition = 'a' def peek(self): if self.condition == 'a': self.condition = 'b' return 0 elif self.condition == 'e': self.condition = 'e' return 8 elif self.condition == 'f': self.condition = 'g' return 10 elif self.condition == 'g': self.condition = 'h' return 11 else: raise KeyError() def check(self): if self.condition == 'b': self.condition = 'c' return 1 elif self.condition == 'd': self.condition = 'g' return 4 elif self.condition == 'e': self.condition = 'h' return 9 else: raise KeyError() def add(self): if self.condition == 'c': self.condition = 'd' return 2 elif self.condition == 'd': self.condition = 'e' return 3 elif self.condition == 'e': self.condition = 'f' return 6 else: raise KeyError() def chip(self): if self.condition == 'd': self.condition = 'f' return 5 elif self.condition == 'e': self.condition = 'g' return 7 else: raise KeyError()" "class Mealy_machine(object): transform_conditions = ((('b', 0), ()), ((), ('c', 1)), (('d', 2), ('h', 3)), (('d', 5), ('e', 4)), (('f', 6), ('e', 7)), ((), ('g', 8)), ((), ('h', 9)), (('f', 10), ('d', 11))) available_actions = ('jump', 'fill') def __init__(self): self.condition = 'a' self.int_condition = 0 self.value = 0 self.act_number = 0 def jump(self): return self.action('jump') def fill(self): return self.action('fill') def action(self, action_name): self.set_action_number(action_name) self.check_ability() self.set_properties() return self.value def set_action_number(self, action_name): self.act_number = self.available_actions.index(action_name) def check_ability(self): condition_action = self.transform_conditions[self.int_condition][self.act_number] if condition_action == (): raise KeyError def set_properties(self): self.set_value() self.set_condition() def set_value(self): self.value = self.transform_conditions[self.int_condition][self.act_number][1] def set_condition(self): self.condition = self.transform_conditions[self.int_condition][self.act_number][0] self.int_condition = ord(self.condition) - 97 def main(): mealy = Mealy_machine() return mealy" "class main: def __init__(self): self.pos = 'A' def solve(self, dct): if self.pos in dct: ret = dct[self.pos][1] self.pos = dct[self.pos][0] return ret raise KeyError def click(self): return self.solve({'A': ['B', 0], 'B': ['C', 1], 'D': ['E', 5], 'E': ['F', 6]}) def jump(self): return self.solve({'B': ['E', 2], 'C': ['D', 3], 'G': ['D', 9]}) def glare(self): return self.solve({'C': ['C', 4], 'F': ['G', 7], 'G': ['A', 8]})" "class main: stat = 'A' def wreck(self): match self.stat: case 'A': self.stat = 'B' return 0 case 'B': raise KeyError case 'C': raise KeyError case 'D': raise KeyError case 'E': raise KeyError case 'F': self.stat = 'G' return 7 case 'G': raise KeyError case 'H': raise KeyError def shift(self): match self.stat: case 'A': raise KeyError case 'B': raise KeyError case 'C': self.stat = 'A' return 4 case 'D': self.stat = 'E' return 5 case 'E': raise KeyError case 'F': self.stat = 'C' return 8 case 'G': raise KeyError case 'H': raise KeyError def cull(self): match self.stat: case 'A': self.stat = 'D' return 1 case 'B': self.stat = 'C' return 2 case 'C': self.stat = 'D' return 3 case 'D': raise KeyError case 'E': self.stat = 'F' return 6 case 'F': self.stat = 'H' return 9 case 'G': self.stat = 'H' return 10 case 'H': raise KeyError def fetch(self): match self.stat: case 'A': raise KeyError case 'B': raise KeyError case 'C': raise KeyError case 'D': raise KeyError case 'E': raise KeyError case 'F': raise KeyError case 'G': self.stat = 'C' return 11 case 'H': raise KeyError" "class Denton: def __init__(self): ss = ['A', 'B', 'C', 'D', 'E', 'F'] ds = ['A', 'C', 'E'] sv = [['A', 1], ['C', 2], ['F', 4], ['E', 5], ['F', 6], ['D', 8]] dv = [['B', 0], ['D', 3], ['B', 7]] self.sdic = {ss[i]: sv[i] for i in range(0, len(ss))} self.ddic = {ds[j]: dv[j] for j in range(0, len(ds))} self.cur_state = 'A' def sweep(self): try: outp = self.sdic.get(self.cur_state)[1] self.cur_state = self.sdic.get(self.cur_state)[0] return outp except TypeError: raise KeyError('KeyError') def daub(self): try: outp = self.ddic.get(self.cur_state)[1] self.cur_state = self.ddic.get(self.cur_state)[0] return outp except TypeError: raise KeyError('KeyError') def main(): ob = Denton() return ob" "class Mili: state = 'A' def sort(self): if self.state == 'A': return 2 elif self.state == 'B': self.state = 'C' return 3 elif self.state == 'C': self.state = 'F' return 6 else: raise KeyError def visit(self): if self.state == 'A': self.state = 'C' return 1 elif self.state == 'C': self.state = 'D' return 4 elif self.state == 'D': self.state = 'E' return 7 else: raise KeyError def pull(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'E': self.state = 'F' return 8 elif self.state == 'F': self.state = 'G' return 9 elif self.state == 'C': self.state = 'G' return 5 else: raise KeyError def main(): return Mili()" "class main1: status = '' def __init__(self): self.status = 'A' def run(self): if self.status == 'A': self.status = 'B' return 0 if self.status == 'G': self.status = 'D' return 9 else: raise KeyError def shift(self): if self.status == 'B': self.status = 'C' return 1 if self.status == 'C': self.status = 'D' return 3 if self.status == 'F': self.status = 'G' return 7 else: raise KeyError def debug(self): if self.status == 'B': self.status = 'F' return 2 if self.status == 'D': self.status = 'E' return 4 if self.status == 'E': self.status = 'E' return 6 if self.status == 'G': self.status = 'H' return 8 if self.status == 'H': self.status = 'H' return 10 else: raise KeyError def fade(self): if self.status == 'E': self.status = 'F' return 5 if self.status == 'H': self.status = 'E' return 11 else: raise KeyError def main(): return main1()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def slur(self): return self.update({State.A: [State.B, 0], State.B: [State.D, 3], State.D: [State.G, 6], State.E: [State.F, 7], State.H: [State.C, 11]}) def pose(self): return self.update({State.A: [State.F, 1], State.B: [State.C, 2], State.C: [State.D, 4], State.D: [State.E, 5], State.E: [State.C, 8], State.F: [State.G, 9], State.G: [State.H, 10]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main: def __init__(self): self.condition = 'A' def walk(self): if self.condition == 'A': self.condition = 'B' return 0 elif self.condition == 'B': self.condition = 'C' return 1 elif self.condition == 'C': self.condition = 'C' return 4 elif self.condition == 'F': self.condition = 'H' return 8 elif self.condition == 'G': self.condition = 'B' return 10 else: raise KeyError def draw(self): if self.condition == 'C': self.condition = 'D' return 2 elif self.condition == 'E': self.condition = 'F' return 6 elif self.condition == 'F': self.condition = 'G' return 7 elif self.condition == 'G': self.condition = 'H' return 9 elif self.condition == 'H': self.condition = 'C' return 11 else: raise KeyError def throw(self): if self.condition == 'C': self.condition = 'F' return 3 elif self.condition == 'D': self.condition = 'E' return 5 else: raise KeyError" "class one: a = 6 def run(self): if self.a == 6: self.a = 0 elif self.a == 3: self.a = 4 elif self.a == 4: self.a = 5 else: raise KeyError return self.a def coat(self): if self.a == 0: self.a = 3 elif self.a == 5 or self.a == 8: self.a = 8 elif self.a == 6: self.a == 1 elif self.a == 1 or self.a == 7: self.a = 9 else: raise KeyError return self.a def throw(self): if self.a == 6: self.a = 2 elif self.a == 4: self.a = 6 elif self.a == 5 or self.a == 8: self.a = 7 else: raise KeyError return self.a def main(): return one()" "class Mills: def __init__(self): self.state = 'A' def add(self): if self.state == 'A': return 1 elif self.state == 'B': self.state = 'E' return 4 elif self.state == 'C': self.state = 'D' return 5 elif self.state == 'E': self.state = 'F' return 8 else: raise KeyError def fade(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'D': self.state = 'E' return 7 else: raise KeyError def loop(self): if self.state == 'A': self.state = 'E' return 2 elif self.state == 'B': self.state = 'C' return 3 elif self.state == 'C': self.state = 'F' return 6 else: raise KeyError def main(): obj = Mills() return obj" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class StateMachine: state = State.A def reset(self): return self.update({State.B: [State.C, 1], State.C: [State.C, 3], State.D: [State.E, 5], State.F: [State.F, 7]}) def edit(self): return self.update({State.C: [State.F, 4], State.E: [State.F, 6]}) def peep(self): return self.update({State.A: [State.B, 0], State.F: [State.B, 8], State.C: [State.D, 2]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main: def __init__(self): self.__state = 'A' def skip(self): if self.__state == 'A': self.__state = 'B' return 0 if self.__state == 'B': self.__state = 'C' return 1 if self.__state == 'C': self.__state = 'E' return 3 if self.__state == 'D': self.__state = 'A' return 5 if self.__state == 'E': self.__state = 'H' return 7 if self.__state == 'H': self.__state = 'A' return 10 raise KeyError def drag(self): if self.__state == 'C': self.__state = 'D' return 2 if self.__state == 'D': self.__state = 'E' return 4 if self.__state == 'E': self.__state = 'F' return 6 if self.__state == 'F': self.__state = 'G' return 8 if self.__state == 'G': self.__state = 'H' return 9 if self.__state == 'H': self.__state = 'D' return 11 raise KeyError" "class Class: def __init__(self): self.state = 'A' def chat(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 2 elif self.state == 'C': self.state = 'D' return 4 elif self.state == 'D': self.state = 'D' return 6 elif self.state == 'F': self.state = 'D' return 8 else: raise KeyError def flip(self): if self.state == 'D': self.state = 'E' return 5 elif self.state == 'E': self.state = 'F' return 7 else: raise KeyError def begin(self): if self.state == 'B': self.state = 'F' return 3 elif self.state == 'A': self.state = 'F' return 1 else: raise KeyError def main(): obj = Class() return obj" "class Mily: def __init__(self): self.state = 'A' def rev(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'D': self.state = 'E' return 5 else: raise KeyError def begin(self): if self.state == 'B': self.state = 'C' return 1 elif self.state == 'C': self.state = 'F' return 4 elif self.state == 'D': self.state = 'A' return 6 elif self.state == 'G': self.state = 'H' return 10 elif self.state == 'H': self.state = 'F' return 11 else: raise KeyError def scan(self): if self.state == 'B': self.state = 'F' return 2 elif self.state == 'C': self.state = 'D' return 3 elif self.state == 'D': self.state = 'H' return 7 elif self.state == 'E': self.state = 'F' return 8 elif self.state == 'F': self.state = 'G' return 9 else: raise KeyError def race(self): if self.state == 'D': self.state = 'H' return 4 elif self.state == 'H': self.state = 'A' return 11 else: raise KeyError def main(): obj = Mily() return obj" "class main: def __init__(self): self.state = 'A' def fetch(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'D': self.state = 'F' return 5 elif self.state == 'F': self.state = 'G' return 7 elif self.state == 'H': self.state = 'A' return 11 else: raise KeyError def stop(self): if self.state == 'A': self.state = 'G' return 1 elif self.state == 'B': self.state = 'C' return 2 elif self.state == 'F': self.state = 'A' return 8 else: raise KeyError def trash(self): if self.state == 'C': self.state = 'D' return 3 elif self.state == 'E': self.state = 'F' return 6 elif self.state == 'H': self.state = 'D' return 10 else: raise KeyError def sweep(self): if self.state == 'D': self.state = 'E' return 4 elif self.state == 'G': self.state = 'H' return 9 else: raise KeyError" "import enum class MilliState(enum.Enum): STATE_A = 0 STATE_B = 1 STATE_C = 2 STATE_D = 3 STATE_E = 4 STATE_F = 5 STATE_G = 6 STATE_H = 7 class Milli: def __init__(self, state): self._state = state def rush(self): if self._state == MilliState.STATE_A: self._state = MilliState.STATE_B return 0 elif self._state == MilliState.STATE_E: self._state = MilliState.STATE_F return 7 elif self._state == MilliState.STATE_G: self._state = MilliState.STATE_E return 10 else: raise KeyError def base(self): if self._state == MilliState.STATE_A: self._state = MilliState.STATE_F return 1 elif self._state == MilliState.STATE_B: self._state = MilliState.STATE_C return 4 elif self._state == MilliState.STATE_C: self._state = MilliState.STATE_D return 5 elif self._state == MilliState.STATE_G: self._state = MilliState.STATE_H return 9 else: raise KeyError def load(self): if self._state == MilliState.STATE_A: self._state = MilliState.STATE_G return 3 elif self._state == MilliState.STATE_F: self._state = MilliState.STATE_G return 8 else: raise KeyError def paint(self): if self._state == MilliState.STATE_A: self._state = MilliState.STATE_H return 2 elif self._state == MilliState.STATE_H: self._state = MilliState.STATE_B return 11 elif self._state == MilliState.STATE_D: self._state = MilliState.STATE_E return 6 else: raise KeyError def main(): return Milli(MilliState.STATE_A)" "class MiliMachine: currentNode = 'A' def show(self): if self.currentNode == 'A': self.currentNode = 'B' return 0 elif self.currentNode == 'B': raise KeyError elif self.currentNode == 'C': return 4 elif self.currentNode == 'D': self.currentNode = 'F' return 7 elif self.currentNode == 'E': raise KeyError elif self.currentNode == 'F': raise KeyError def make(self): if self.currentNode == 'A': raise KeyError elif self.currentNode == 'B': raise KeyError elif self.currentNode == 'C': self.currentNode = 'A' return 5 elif self.currentNode == 'D': raise KeyError elif self.currentNode == 'E': self.currentNode = 'F' return 8 elif self.currentNode == 'F': raise KeyError def apply(self): if self.currentNode == 'A': self.currentNode = 'D' return 1 elif self.currentNode == 'B': self.currentNode = 'C' return 2 elif self.currentNode == 'C': self.currentNode = 'D' return 3 elif self.currentNode == 'D': self.currentNode = 'E' return 6 elif self.currentNode == 'E': raise KeyError elif self.currentNode == 'F': raise KeyError def main(): o = MiliMachine() return o" "class main: temp = 'A' def slur(self): match self.temp: case 'B': self.temp = 'C' return 2 case 'C': return 5 case 'G': self.temp = 'H' return 10 case 'E': self.temp = 'B' return 8 case _: raise KeyError def punch(self): match self.temp: case 'A': self.temp = 'B' return 0 case 'H': self.temp = 'D' return 11 case 'F': self.temp = 'G' return 9 case _: raise KeyError def tail(self): match self.temp: case 'C': self.temp = 'D' return 4 case 'D': self.temp = 'E' return 6 case 'E': self.temp = 'F' return 7 case 'B': self.temp = 'F' return 3 case 'A': self.temp = 'F' return 1 case _: raise KeyError" "class main: def __init__(self): self.level = 0 def chalk(self): if self.level == 0: self.level = 1 return 0 elif self.level == 1: self.level = 2 return 1 elif self.level == 3: self.level = 4 return 3 elif self.level == 4: self.level = 5 return 6 elif self.level == 5: self.level = 1 return 8 else: raise KeyError() def tweak(self): if self.level == 2: self.level = 3 return 2 elif self.level == 3: return 5 elif self.level == 5: self.level = 6 return 7 else: raise KeyError() def shade(self): if self.level == 3: self.level = 5 return 4 elif self.level == 5: self.level = 0 return 9 else: raise KeyError()" "class FSM: def __init__(self): self.a = 'a' self.b = 'b' self.c = 'c' self.d = 'd' self.e = 'e' self.f = 'f' self.g = 'g' self.current_state = self.a def walk(self): match self.current_state: case self.a: self.current_state = self.b return 0 case self.d: self.current_state = self.g return 4 case self.g: self.current_state = self.e return 9 case self.e: self.current_state = self.f return 5 case _: raise KeyError def reset(self): match self.current_state: case self.b: self.current_state = self.c return 1 case self.c: self.current_state = self.d return 2 case self.d: self.current_state = self.e return 3 case self.e: self.current_state = self.a return 6 case _: raise KeyError def share(self): match self.current_state: case self.e: self.current_state = self.c return 7 case self.f: self.current_state = self.g return 8 case _: raise KeyError def main(): a = FSM() return a" "class Ooo: def __init__(self): self.sost = 'A' def smash(self): if self.sost == 'A': self.sost = 'B' return 0 if self.sost == 'D': self.sost = 'E' return 5 if self.sost == 'E': self.sost = 'F' return 7 if self.sost == 'G': return 11 raise KeyError def link(self): if self.sost == 'A': self.sost = 'G' return 1 if self.sost == 'B': self.sost = 'C' return 2 if self.sost == 'C': self.sost = 'D' return 3 if self.sost == 'D': self.sost = 'H' return 6 if self.sost == 'F': self.sost = 'G' return 8 raise KeyError def hoard(self): if self.sost == 'C': self.sost = 'H' return 4 if self.sost == 'G': self.sost = 'H' return 9 raise KeyError def play(self): if self.sost == 'G': self.sost = 'B' return 10 raise KeyError def main(): return Ooo()" "class Machine: def __init__(self): self.status = 'A' def step(self): if self.status == 'A': self.status = 'A' return 1 if self.status == 'B': self.status = 'C' return 3 if self.status == 'F': self.status = 'D' return 7 else: raise KeyError def log(self): if self.status == 'A': self.status = 'B' return 0 if self.status == 'C': self.status = 'D' return 4 if self.status == 'E': self.status = 'F' return 6 else: raise KeyError def rush(self): if self.status == 'A': self.status = 'C' return 2 if self.status == 'D': self.status = 'E' return 5 if self.status == 'F': self.status = 'F' return 8 else: raise KeyError def main(): return Machine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class StateMachine: state = State.A def visit(self): return self.update({State.A: [State.B, 0], State.F: [State.C, 8]}) def stand(self): return self.update({State.A: [State.C, 1], State.B: [State.C, 2], State.D: [State.E, 5], State.E: [State.F, 6], State.F: [State.F, 9]}) def tweak(self): return self.update({State.B: [State.G, 3], State.C: [State.D, 4], State.F: [State.G, 7]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main: state = 'A' def fade(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 2 elif self.state == 'C': self.state = 'C' return 5 elif self.state == 'E': self.state = 'B' return 8 raise KeyError pass def widen(self): if self.state == 'A': self.state = 'E' return 1 elif self.state == 'B': self.state = 'B' return 3 elif self.state == 'C': self.state = 'D' return 4 elif self.state == 'D': self.state = 'E' return 6 elif self.state == 'E': self.state = 'F' return 7 raise KeyError pass o = main()" "class A: state = 'A' def unite(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'C': self.state = 'A' return 3 elif self.state == 'E': self.state = 'C' return 7 elif self.state == 'G': self.state = 'D' return 11 else: raise KeyError def check(self): if self.state == 'B': self.state = 'C' return 1 elif self.state == 'E': self.state = 'F' return 5 elif self.state == 'G': self.state = 'H' return 9 else: raise KeyError def bolt(self): if self.state == 'C': self.state = 'D' return 2 elif self.state == 'D': self.state = 'E' return 4 elif self.state == 'E': self.state = 'G' return 6 elif self.state == 'F': self.state = 'G' return 8 elif self.state == 'G': self.state = 'A' return 10 else: raise KeyError def main(): return A()" "class main: def __init__(self): self.condition = 'A' def look(self): if self.condition == 'A': self.condition = 'A' return 2 elif self.condition == 'C': self.condition = 'F' return 5 elif self.condition == 'D': self.condition = 'E' return 6 elif self.condition == 'F': self.condition = 'F' return 8 else: raise KeyError def sit(self): if self.condition == 'A': self.condition = 'B' return 0 elif self.condition == 'E': self.condition = 'F' return 7 else: raise KeyError def fork(self): if self.condition == 'A': self.condition = 'E' return 1 elif self.condition == 'B': self.condition = 'C' return 3 elif self.condition == 'C': self.condition = 'D' return 4 else: raise KeyError" "from enum import Enum, auto class State(Enum): A = auto() B = auto() C = auto() D = auto() E = auto() F = auto() class main: def __init__(self): self.state = State.A self.shade_next = 0 self.paste_next = 1 pass def next_(self, next_state): match self.state: case State.A: if next_state == self.shade_next: self.state = State.D return 1 else: self.state = State.B return 0 case State.B: if next_state == self.paste_next: raise KeyError self.state = State.C return 2 case State.C: if next_state == self.shade_next: raise KeyError self.state = State.D return 3 case State.D: if next_state == self.shade_next: self.state = State.E return 4 else: self.state = State.F return 5 case State.E: if next_state == self.shade_next: raise KeyError self.state = State.F return 6 case State.F: if next_state == self.shade_next: self.state = State.C return 8 else: self.state = State.F return 7 def shade(self): return self.next_(self.shade_next) pass def paste(self): return self.next_(self.paste_next) pass" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class StateMachine: state = State.A def drive(self): return self.update({State.A: [State.B, 0], State.B: [State.B, 3], State.D: [State.E, 5], State.E: [State.F, 6]}) def chip(self): return self.update({State.B: [State.C, 2], State.A: [State.E, 1], State.F: [State.B, 8], State.E: [State.E, 7], State.C: [State.D, 4]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class FSM: def __init__(self): self.a = 'a' self.b = 'b' self.c = 'c' self.d = 'd' self.e = 'e' self.f = 'f' self.g = 'g' self.arr = [[0, 1, 0.1], [4, 3, 2], [0.1, 5, 0.1], [6, 0.1, 0.1], [0.1, 7, 0.1], [0.1, 0.1, 8], [9, 0.1, 0.1]] self.current_state = self.a self.pointer1 = 0 def patch(self): if self.current_state == self.a: p1 = self.pointer1 p2 = 0 self.pointer1 = 1 self.current_state = self.b return self.arr[p1][p2] elif self.current_state == self.b: p1 = self.pointer1 p2 = 0 self.pointer1 = 4 self.current_state = self.e return self.arr[p1][p2] elif self.current_state == self.c: raise KeyError() elif self.current_state == self.d: p1 = self.pointer1 p2 = 0 self.pointer1 = 4 self.current_state = self.e return self.arr[p1][p2] elif self.current_state == self.e: raise KeyError() elif self.current_state == self.f: raise KeyError() elif self.current_state == self.g: p1 = self.pointer1 p2 = 0 self.pointer1 = 3 self.current_state = self.d return self.arr[p1][p2] def spin(self): if self.current_state == self.a: p1 = self.pointer1 p2 = 1 self.pointer1 = 3 self.current_state = self.d return self.arr[p1][p2] elif self.current_state == self.b: p1 = self.pointer1 p2 = 1 self.pointer1 = 5 self.current_state = self.f return self.arr[p1][p2] elif self.current_state == self.c: p1 = self.pointer1 p2 = 1 self.pointer1 = 3 self.current_state = self.d return self.arr[p1][p2] elif self.current_state == self.d: raise KeyError() elif self.current_state == self.e: p1 = self.pointer1 p2 = 1 self.pointer1 = 5 self.current_state = self.f return self.arr[p1][p2] elif self.current_state == self.f: raise KeyError() elif self.current_state == self.g: raise KeyError() def type(self): if self.current_state == self.a: raise KeyError() elif self.current_state == self.b: p1 = self.pointer1 p2 = 2 self.pointer1 = 2 self.current_state = self.c return self.arr[p1][p2] elif self.current_state == self.c: raise KeyError() elif self.current_state == self.d: raise KeyError() elif self.current_state == self.e: raise KeyError() elif self.current_state == self.f: p1 = self.pointer1 p2 = 2 self.pointer1 = 6 self.current_state = self.g return self.arr[p1][p2] elif self.current_state == self.g: raise KeyError() def main(): return FSM()" "class Mealy: state = 'A' def order(self): if self.state == 'A': self.state = 'B' return 0 if self.state == 'F': self.state = 'G' return 9 if self.state == 'E': self.state = 'A' return 8 if self.state == 'C': self.state = 'F' return 4 raise KeyError def peep(self): if self.state == 'B': self.state = 'B' return 2 if self.state == 'C': self.state = 'D' return 3 if self.state == 'D': self.state = 'G' return 6 if self.state == 'E': self.state = 'F' return 7 raise KeyError def coat(self): if self.state == 'D': self.state = 'E' return 5 if self.state == 'B': self.state = 'C' return 1 raise KeyError def main(): o = Mealy() return o" "class A: state = 'A' def group(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'E' return 4 elif self.state == 'C': self.state = 'D' return 5 elif self.state == 'D': self.state = 'A' return 7 else: raise KeyError def daub(self): if self.state == 'A': self.state = 'A' return 1 elif self.state == 'D': self.state = 'E' return 6 elif self.state == 'E': self.state = 'F' return 8 else: raise KeyError def clear(self): if self.state == 'B': self.state = 'C' return 3 elif self.state == 'A': self.state = 'E' return 2 else: raise KeyError def main(): return A()" "class MiliAutomat: def __init__(self): self.state = 'A' self.pose_values = {'A': ('B', 0), 'E': ('E', 6), 'F': ('C', 8)} self.order_values = {'A': ('C', 1), 'B': ('C', 2), 'C': ('D', 3), 'D': ('E', 4), 'E': ('F', 5), 'F': ('D', 7)} def pose(self): return self.make_action(self.pose_values) def order(self): return self.make_action(self.order_values) def make_action(self, dict): new_state = dict[self.state] self.state = new_state[0] return new_state[1] def main(): return MiliAutomat()" "class main: stat = 'A' def rev(self): match self.stat: case 'A': self.stat = 'B' return 0 case 'B': self.stat = 'C' return 1 case 'C': raise KeyError case 'D': self.stat = 'G' return 4 case 'E': self.stat = 'F' return 5 case 'F': self.stat = 'G' return 8 case 'G': raise KeyError def trace(self): match self.stat: case 'A': raise KeyError case 'B': raise KeyError case 'C': self.stat = 'D' return 2 case 'D': self.stat = 'E' return 3 case 'E': self.stat = 'C' return 7 case 'F': raise KeyError case 'G': raise KeyError def run(self): match self.stat: case 'A': raise KeyError case 'B': raise KeyError case 'C': raise KeyError case 'D': raise KeyError case 'E': self.stat = 'A' return 6 case 'F': return 9 case 'G': raise KeyError" "class Milly: def __init__(self): self.rule = 'A' def rush(self): if self.rule == 'A': self.rule = 'B' return 0 if self.rule == 'C': self.rule = 'A' return 4 if self.rule == 'D': self.rule = 'E' return 5 else: raise KeyError def chat(self): if self.rule == 'A': self.rule = 'D' return 1 if self.rule == 'B': self.rule = 'C' return 2 if self.rule == 'D': return 6 if self.rule == 'E': self.rule = 'F' return 7 else: raise KeyError def tweak(self): if self.rule == 'C': self.rule = 'D' return 3 if self.rule == 'E': self.rule = 'B' return 8 else: raise KeyError def main(): obj = Milly() return obj" "class main: def __init__(self): self.dct = {'A': [[self.grow, self.move, self.stay], [2, 0, 1], ['A', 'B', 'F']], 'B': [[self.move, self.stay], [3, 4], ['C', 'F']], 'C': [[self.stay], [5], ['D']], 'D': [[self.grow], [6], ['E']], 'E': [[self.grow], [7], ['F']], 'F': [[self.move], [8], ['C']]} self.state = 'A' self.k = 0 def grow(self): temp = self.dct[self.state] if self.grow in temp[0]: self.state = temp[2][temp[0].index(self.grow)] self.k = temp[1][temp[0].index(self.grow)] return self.k else: raise KeyError def move(self): temp = self.dct[self.state] if self.move in temp[0]: self.state = temp[2][temp[0].index(self.move)] self.k = temp[1][temp[0].index(self.move)] return self.k else: raise KeyError def stay(self): temp = self.dct[self.state] if self.stay in temp[0]: self.state = temp[2][temp[0].index(self.stay)] self.k = temp[1][temp[0].index(self.stay)] return self.k else: raise KeyError" "class StateMachine: state = 'A' def open(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'E' return 2 elif self.state == 'D': self.state = 'E' return 5 elif self.state == 'C': self.state = 'D' return 3 elif self.state == 'F': self.state = 'G' return 8 else: raise KeyError def file(self): if self.state == 'B': self.state = 'C' return 1 elif self.state == 'C': self.state = 'A' return 4 elif self.state == 'E': self.state = 'F' return 7 elif self.state == 'D': self.state = 'F' return 6 elif self.state == 'F': self.state = 'C' return 9 else: raise KeyError def main(): return StateMachine()" "class main: def __init__(self): self.level = 0 def hurry(self): if self.level == 0: self.level = 1 return 0 elif self.level == 1: self.level = 2 return 2 elif self.level == 3: self.level = 4 return 6 else: raise KeyError() def mix(self): if self.level == 0: self.level = 2 return 1 elif self.level == 2: self.level = 3 return 5 elif self.level == 1: self.level = 4 return 3 else: raise KeyError() def rig(self): if self.level == 1: self.level = 5 return 4 elif self.level == 4: self.level = 5 return 7 elif self.level == 5: self.level = 3 return 8 else: raise KeyError()" "class main: def __init__(self): self._state = 'A' self._graph = {('A', 'group'): ('B', 0), ('A', 'jump'): ('D', 1), ('B', 'group'): ('D', 3), ('B', 'jump'): ('C', 2), ('C', 'jump'): ('D', 4), ('C', 'mix'): ('F', 5), ('D', 'jump'): ('E', 6), ('E', 'group'): ('F', 7), ('F', 'group'): ('F', 9), ('F', 'jump'): ('G', 8)} def jump(self): (self._state, ret_value) = self._graph[self._state, 'jump'] return ret_value def mix(self): (self._state, ret_value) = self._graph[self._state, 'mix'] return ret_value def group(self): (self._state, ret_value) = self._graph[self._state, 'group'] return ret_value" "class main: def __init__(self): self.state = 'A' self._graph = {('A', 'reset'): ('B', 0), ('A', 'wreck'): ('C', 1), ('A', 'push'): ('A', 2), ('B', 'wreck'): ('C', 3), ('B', 'push'): ('F', 4), ('C', 'reset'): ('D', 5), ('C', 'wreck'): ('F', 6), ('D', 'push'): ('E', 7), ('E', 'reset'): ('F', 8), ('F', 'wreck'): ('G', 9)} def push(self): (self.state, ret_value) = self._graph[self.state, 'push'] return ret_value def reset(self): (self.state, ret_value) = self._graph[self.state, 'reset'] return ret_value def wreck(self): (self.state, ret_value) = self._graph[self.state, 'wreck'] return ret_value" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def share(self): return self.update({State.A: [State.B, 0], State.E: [State.B, 7], State.C: [State.D, 2], State.F: [State.G, 9], State.D: [State.E, 4]}) def drive(self): return self.update({State.B: [State.C, 1], State.E: [State.F, 6], State.G: [State.H, 10], State.C: [State.F, 3]}) def melt(self): return self.update({State.E: [State.E, 8], State.H: [State.B, 11], State.D: [State.F, 5]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main: state = 'A' def __init__(self): self.state = 'A' def load(self): match self.state: case 'A': self.state = 'B' return 0 case 'B': self.state = 'C' return 1 case 'C': self.state = 'G' return 4 case 'D': raise KeyError case 'E': return 7 case 'F': raise KeyError case 'G': raise KeyError def tweak(self): match self.state: case 'A': raise KeyError case 'B': raise KeyError case 'C': self.state = 'A' return 3 case 'D': self.state = 'E' return 5 case 'E': raise KeyError case 'F': raise KeyError case 'G': raise KeyError def speed(self): match self.state: case 'A': raise KeyError case 'B': raise KeyError case 'C': self.state = 'D' return 2 case 'D': raise KeyError case 'E': self.state = 'F' return 6 case 'F': self.state = 'G' return 8 case 'G': self.state = 'D' return 9" "class Automate: state = '' def __init__(self, x): self.state = x def load(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 1 elif self.state == 'E': self.state = 'A' return 6 elif self.state == 'F': self.state = 'A' return 8 else: raise KeyError() def code(self): if self.state == 'C': self.state = 'D' return 3 elif self.state == 'E': return 7 else: raise KeyError() def shade(self): if self.state == 'D': self.state = 'E' return 4 elif self.state == 'B': self.state = 'E' return 2 elif self.state == 'E': self.state = 'F' return 5 else: raise KeyError('KeyError') def main(): return Automate('A')" "class Mili: state = 'A' def send(self): if self.state == 'A': self.state = 'A' return 1 elif self.state == 'B': self.state = 'C' return 3 elif self.state == 'C': self.state = 'E' return 5 elif self.state == 'D': self.state = 'E' return 6 else: raise KeyError def scrub(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'D': self.state = 'A' return 7 else: raise KeyError def tweak(self): if self.state == 'A': self.state = 'C' return 2 elif self.state == 'C': self.state = 'D' return 4 elif self.state == 'E': self.state = 'F' return 8 else: raise KeyError def main(): return Mili()" "class Mili: state = 'A' def order(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 1 elif self.state == 'D': self.state = 'E' return 6 elif self.state == 'E': self.state = 'F' return 7 elif self.state == 'C': self.state = 'F' return 5 elif self.state == 'G': self.state = 'H' return 11 else: raise KeyError def swap(self): if self.state == 'B': self.state = 'E' return 2 elif self.state == 'F': self.state = 'G' return 9 else: raise KeyError def race(self): if self.state == 'C': self.state = 'D' return 4 elif self.state == 'F': self.state = 'B' return 10 elif self.state == 'B': self.state = 'H' return 3 elif self.state == 'E': self.state = 'G' return 8 else: raise KeyError def main(): return Mili()" "class FSM: def __init__(self): self.current_state = 'a' def move(self): if self.current_state == 'a': self.current_state = 'b' return 0 elif self.current_state == 'c': self.current_state = 'd' return 3 elif self.current_state == 'd': self.current_state = 'f' return 5 elif self.current_state == 'e': self.current_state = 'f' return 6 elif self.current_state == 'f': self.current_state = 'g' return 8 else: raise KeyError def drive(self): if self.current_state == 'b': self.current_state = 'c' return 1 elif self.current_state == 'e': self.current_state = 'g' return 7 else: raise KeyError def view(self): if self.current_state == 'b': self.current_state = 'e' return 2 elif self.current_state == 'd': self.current_state = 'e' return 4 elif self.current_state == 'f': self.current_state = 'c' return 9 else: raise KeyError def main(): return FSM()" "class Mili: def __init__(self): self._state = 'A' self._graph = {('A', 'slur'): ('B', 0), ('A', 'hop'): ('F', 1), ('B', 'hop'): ('C', 2), ('B', 'slur'): ('F', 3), ('C', 'hop'): ('D', 4), ('C', 'slur'): ('G', 5), ('D', 'slur'): ('E', 6), ('E', 'slur'): ('F', 7), ('F', 'slur'): ('G', 8), ('G', 'slur'): ('G', 9)} def slur(self): (self._state, ret_value) = self._graph[self._state, 'slur'] return ret_value def hop(self): (self._state, ret_value) = self._graph[self._state, 'hop'] return ret_value def main(): return Mili() o = main()" "def main(): class States: A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class FSM: def __init__(self): self.current_state = States.A def trash(self): if self.current_state == States.A: self.current_state = States.B return 0 if self.current_state == States.B: self.current_state = States.C return 2 if self.current_state == States.C: self.current_state = States.D return 5 if self.current_state == States.F: self.current_state = States.C return 8 raise KeyError def base(self): if self.current_state == States.A: self.current_state = States.C return 1 if self.current_state == States.B: self.current_state = States.B return 3 raise KeyError def cull(self): if self.current_state == States.D: self.current_state = States.E return 6 if self.current_state == States.E: self.current_state = States.F return 7 if self.current_state == States.B: self.current_state = States.F return 4 raise KeyError return FSM()" "class Action: def __init__(self, states: dict): self.states = states def act(self, current: str): if current in self.states: _states = self.states[current] else: raise KeyError return _states class FSM: def __init__(self, current: str): self.current = current self.etch_act = Action({'A': ('A', 3), 'D': ('E', 6)}) self.melt_act = Action({'A': ('B', 0), 'C': ('D', 5), 'E': ('F', 7)}) self.paste_act = Action({'A': ('C', 2)}) self.cast_act = Action({'A': ('E', 1), 'B': ('C', 4), 'E': ('E', 8)}) def etch(self): try: states = self.etch_act.act(self.current) self.current = states[0] return states[1] except KeyError: raise KeyError def melt(self): try: states = self.melt_act.act(self.current) self.current = states[0] return states[1] except KeyError: raise KeyError def paste(self): try: states = self.paste_act.act(self.current) self.current = states[0] return states[1] except KeyError: raise KeyError def cast(self): try: states = self.cast_act.act(self.current) self.current = states[0] return states[1] except KeyError: raise KeyError def main(): return FSM('A')" "class Miles_FSM: def __init__(self): self.state = 'A' def roam(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 1 elif self.state == 'C': self.state = 'E' return 3 elif self.state == 'D': self.state = 'F' return 6 elif self.state == 'E': self.state = 'F' return 8 else: raise KeyError def put(self): if self.state == 'C': self.state = 'A' return 4 elif self.state == 'D': self.state = 'E' return 5 else: raise KeyError def clone(self): if self.state == 'C': self.state = 'D' return 2 elif self.state == 'D': self.state = 'B' return 7 else: raise KeyError def main(): obj = Miles_FSM() return obj" "import enum class MilliState(enum.Enum): STATE_A = 0 STATE_B = 1 STATE_C = 2 STATE_D = 3 STATE_E = 4 STATE_F = 5 STATE_G = 6 class Milli: def __init__(self, state): self._state = state def play(self): if self._state == MilliState.STATE_A: self._state = MilliState.STATE_B return 0 elif self._state == MilliState.STATE_C: self._state = MilliState.STATE_D return 3 elif self._state == MilliState.STATE_D: self._state = MilliState.STATE_E return 4 elif self._state == MilliState.STATE_E: self._state = MilliState.STATE_G return 8 else: raise KeyError def amass(self): if self._state == MilliState.STATE_A: self._state = MilliState.STATE_C return 1 elif self._state == MilliState.STATE_D: self._state = MilliState.STATE_B return 5 elif self._state == MilliState.STATE_E: self._state = MilliState.STATE_F return 6 else: raise KeyError def slog(self): if self._state == MilliState.STATE_B: self._state = MilliState.STATE_C return 2 elif self._state == MilliState.STATE_E: self._state = MilliState.STATE_E return 7 elif self._state == MilliState.STATE_F: self._state = MilliState.STATE_G return 9 else: raise KeyError def main(): return Milli(MilliState.STATE_A)" "import enum class MilliState(enum.Enum): STATE_A = 0 STATE_B = 1 STATE_C = 2 STATE_D = 3 STATE_E = 4 STATE_F = 5 STATE_G = 6 class Milli: def __init__(self, state): self._state = state def slog(self): if self._state == MilliState.STATE_A: self._state = MilliState.STATE_B return 0 elif self._state == MilliState.STATE_E: self._state = MilliState.STATE_F return 6 else: raise KeyError def crush(self): if self._state == MilliState.STATE_B: self._state = MilliState.STATE_B return 3 elif self._state == MilliState.STATE_C: self._state = MilliState.STATE_D return 4 elif self._state == MilliState.STATE_D: self._state = MilliState.STATE_E return 5 elif self._state == MilliState.STATE_F: self._state = MilliState.STATE_G return 7 else: raise KeyError def place(self): if self._state == MilliState.STATE_A: self._state = MilliState.STATE_D return 1 elif self._state == MilliState.STATE_B: self._state = MilliState.STATE_C return 2 elif self._state == MilliState.STATE_F: self._state = MilliState.STATE_F return 8 elif self._state == MilliState.STATE_G: self._state = MilliState.STATE_D return 9 else: raise KeyError def main(): return Milli(MilliState.STATE_A)" "class Mile: def __init__(self): self.stage = 'A' def unite(self): if self.stage == 'A': return 1 elif self.stage == 'B': self.stage = 'C' return 2 elif self.stage == 'C': self.stage = 'D' return 3 else: raise KeyError def build(self): if self.stage == 'A': self.stage = 'B' return 0 elif self.stage == 'C': self.stage = 'F' return 6 elif self.stage == 'D': self.stage = 'E' return 7 elif self.stage == 'E': self.stage = 'F' return 8 else: raise KeyError def rush(self): if self.stage == 'C': return 4 else: raise KeyError def skid(self): if self.stage == 'C': self.stage = 'E' return 5 else: raise KeyError def main(): obj = Mile() return obj" "class main: def __init__(self): self.state = 'A' def crawl(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 1 elif self.state == 'C': self.state = 'D' return 2 elif self.state == 'E': self.state = 'F' return 6 elif self.state == 'F': self.state = 'B' return 8 else: raise KeyError def peep(self): if self.state == 'C': self.state = 'G' return 3 elif self.state == 'D': self.state = 'E' return 5 elif self.state == 'H': self.state = 'B' return 11 else: raise KeyError def paste(self): if self.state == 'C': self.state = 'E' return 4 elif self.state == 'F': self.state = 'G' return 7 elif self.state == 'G': self.state = 'H' return 9 else: raise KeyError def punch(self): if self.state == 'G': self.state = 'B' return 10 else: raise KeyError" "class Mili: state = 'A' def walk(self): if self.state == 'A': self.state = 'A' return 1 elif self.state == 'B': self.state = 'C' return 2 elif self.state == 'E': self.state = 'F' return 7 else: raise KeyError def patch(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'C': self.state = 'D' return 5 elif self.state == 'B': self.state = 'F' return 4 else: raise KeyError def view(self): if self.state == 'B': self.state = 'D' return 3 elif self.state == 'D': self.state = 'E' return 6 elif self.state == 'F': self.state = 'A' return 8 else: raise KeyError def main(): return Mili()" "class main: stat = 'A' def exit(self): match self.stat: case 'A': self.stat = 'A' return 1 case 'B': self.stat = 'C' return 2 case 'C': self.stat = 'E' return 5 case 'D': self.stat = 'E' return 6 case 'E': self.stat = 'F' return 7 case 'F': raise KeyError case 'G': raise KeyError def crack(self): match self.stat: case 'A': self.stat = 'B' return 0 case 'B': raise KeyError case 'C': self.stat = 'F' return 4 case 'D': raise KeyError case 'E': raise KeyError case 'F': self.stat = 'G' return 8 case 'G': raise KeyError def unite(self): match self.stat: case 'A': raise KeyError case 'B': raise KeyError case 'C': self.stat = 'D' return 3 case 'D': raise KeyError case 'E': raise KeyError case 'F': self.stat = 'B' return 9 case 'G': raise KeyError" "class main: def __init__(self): self.condition = 'A' def rock(self): if self.condition == 'A': self.condition = 'D' return 1 elif self.condition == 'B': self.condition = 'C' return 2 elif self.condition == 'C': self.condition = 'E' return 5 elif self.condition == 'E': self.condition = 'F' return 7 elif self.condition == 'G': self.condition = 'H' return 10 else: raise KeyError def grow(self): if self.condition == 'A': self.condition = 'B' return 0 elif self.condition == 'B': self.condition = 'F' return 3 elif self.condition == 'E': self.condition = 'B' return 8 elif self.condition == 'C': self.condition = 'D' return 4 elif self.condition == 'D': self.condition = 'E' return 6 elif self.condition == 'F': self.condition = 'G' return 9 elif self.condition == 'G': self.condition = 'D' return 11 else: raise KeyError" "class main: def __init__(self): self.condition = 'A' def click(self): if self.condition == 'B': self.condition = 'C' return 2 elif self.condition == 'C': self.condition = 'D' return 5 elif self.condition == 'F': self.condition = 'B' return 8 else: raise KeyError def grow(self): if self.condition == 'A': self.condition = 'B' return 0 elif self.condition == 'B': self.condition = 'B' return 3 else: raise KeyError def forge(self): if self.condition == 'A': self.condition = 'F' return 1 elif self.condition == 'B': self.condition = 'E' return 4 elif self.condition == 'E': self.condition = 'F' return 7 elif self.condition == 'D': self.condition = 'E' return 6 else: raise KeyError" "class main: def __init__(self): self._state = 'A' self._graph = {('A', 'rig'): ('B', 0), ('A', 'scrub'): ('E', 1), ('B', 'rig'): ('C', 2), ('C', 'rig'): ('D', 3), ('C', 'scrub'): ('H', 4), ('D', 'scrub'): ('E', 5), ('E', 'rig'): ('F', 6), ('F', 'scrub'): ('G', 7), ('G', 'rig'): ('H', 8), ('H', 'rig'): ('A', 9), ('H', 'scrub'): ('D', 10), ('H', 'clear'): ('E', 11)} def rig(self): (self._state, ret_value) = self._graph[self._state, 'rig'] return ret_value def scrub(self): (self._state, ret_value) = self._graph[self._state, 'scrub'] return ret_value def clear(self): (self._state, ret_value) = self._graph[self._state, 'clear'] return ret_value" "class StateMachine: state = 'A' def share(self): if self.state == 'A': self.state = 'B' return 0 if self.state == 'B': self.state = 'H' return 3 if self.state == 'C': self.state = 'D' return 5 if self.state == 'H': self.state = 'A' return 11 if self.state == 'G': return 10 else: raise KeyError def stare(self): if self.state == 'B': return 4 if self.state == 'D': self.state = 'E' return 6 if self.state == 'E': self.state = 'F' return 7 if self.state == 'G': self.state = 'H' return 9 else: raise KeyError def boost(self): if self.state == 'A': self.state = 'F' return 1 if self.state == 'B': self.state = 'C' return 2 if self.state == 'F': self.state = 'G' return 8 else: raise KeyError def main(): return StateMachine()" "class main: def __init__(self): self.state = 'A' def link(self): match self.state: case 'A': self.state = 'B' return 0 case 'B': self.state = 'C' return 2 case 'D': self.state = 'E' return 5 case 'G': self.state = 'B' return 9 case _: raise KeyError def visit(self): match self.state: case 'A': self.state = 'C' return 1 case 'B': return 3 case 'C': self.state = 'D' return 4 case 'D': self.state = 'A' return 6 case 'E': self.state = 'F' return 7 case 'F': self.state = 'G' return 8 case _: raise KeyError" "class Automat: def __init__(self): self.pos = 'A' def load(self): d = dict(A=('B', 0), G=('E', 8), E=('F', 5), H=('F', 9)) (self.pos, val) = d[self.pos] return val def scale(self): d = dict(B=('C', 1), C=('D', 2), F=('G', 6), H=('H', 10)) (self.pos, val) = d[self.pos] return val def cull(self): d = dict(C=('F', 3), D=('E', 4), H=('D', 11), G=('H', 7)) (self.pos, val) = d[self.pos] return val def main(): return Automat()" "class main: current_state = 'A' def scale(self): if self.current_state == 'A': self.current_state = 'B' return 0 elif self.current_state == 'B': self.current_state = 'C' return 1 elif self.current_state == 'C': self.current_state = 'D' return 2 elif self.current_state == 'D': self.current_state = 'B' return 6 else: raise KeyError def mass(self): if self.current_state == 'C': self.current_state = 'A' return 3 elif self.current_state == 'D': self.current_state = 'E' return 5 elif self.current_state == 'E': self.current_state = 'F' return 7 else: raise KeyError def mix(self): if self.current_state == 'E': return 8 elif self.current_state == 'C': return 4 raise KeyError" "class main: def __init__(self): self.condition = 'A' def hoard(self): if self.condition == 'A': self.condition = 'B' return 0 elif self.condition == 'B': self.condition = 'C' return 1 elif self.condition == 'F': self.condition = 'B' return 7 elif self.condition == 'E': self.condition = 'A' return 5 else: raise KeyError def apply(self): if self.condition == 'C': self.condition = 'D' return 2 elif self.condition == 'E': self.condition = 'C' return 6 else: raise KeyError def color(self): if self.condition == 'D': self.condition = 'E' return 3 elif self.condition == 'E': self.condition = 'F' return 4 elif self.condition == 'F': self.condition = 'F' return 8 else: raise KeyError" "import enum class MilliState(enum.Enum): STATE_A = 0 STATE_B = 1 STATE_C = 2 STATE_D = 3 STATE_E = 4 STATE_F = 5 STATE_G = 6 class Milli: def __init__(self, state): self._state = state def move(self): if self._state == MilliState.STATE_A: self._state = MilliState.STATE_B return 0 elif self._state == MilliState.STATE_B: self._state = MilliState.STATE_C return 1 elif self._state == MilliState.STATE_C: self._state = MilliState.STATE_A return 4 elif self._state == MilliState.STATE_G: self._state = MilliState.STATE_B return 9 else: raise KeyError def scrub(self): if self._state == MilliState.STATE_B: self._state = MilliState.STATE_D return 2 elif self._state == MilliState.STATE_C: self._state = MilliState.STATE_D return 3 elif self._state == MilliState.STATE_D: self._state = MilliState.STATE_E return 5 elif self._state == MilliState.STATE_E: self._state = MilliState.STATE_F return 6 elif self._state == MilliState.STATE_F: self._state = MilliState.STATE_G return 7 elif self._state == MilliState.STATE_G: self._state = MilliState.STATE_G return 8 else: raise KeyError def main(): return Milli(MilliState.STATE_A)" "class Node: def __init__(self): self.data = None self.status = 'A' def warp(self): if self.status == 'A': self.data = 0 self.status = 'B' elif self.status == 'C': self.data = 2 self.status = 'D' elif self.status == 'D': self.data = 4 self.status = 'E' elif self.status == 'F': self.data = 7 self.status = 'G' elif self.status == 'G': self.data = 9 self.status = 'H' elif self.status == 'H': self.data = 11 self.status = 'H' else: raise KeyError return self.data def type(self): if self.status == 'C': self.data = 3 self.status = 'A' elif self.status == 'D': self.data = 5 self.status = 'H' elif self.status == 'E': self.data = 6 self.status = 'F' elif self.status == 'F': self.data = 8 self.status = 'A' else: raise KeyError return self.data def widen(self): if self.status == 'B': self.data = 1 self.status = 'C' elif self.status == 'G': self.data = 10 self.status = 'A' else: raise KeyError return self.data def main(): return Node()" "class main: def __init__(self): self.pos = 'A' def warp(self): if self.pos == 'A': self.pos = 'G' return 1 if self.pos == 'G': self.pos = 'H' return 10 if self.pos == 'H': self.pos = 'B' return 11 if self.pos == 'B': return 3 if self.pos == 'C': self.pos = 'A' return 5 if self.pos == 'E': self.pos = 'F' return 7 raise KeyError() def erase(self): if self.pos == 'A': self.pos = 'B' return 0 if self.pos == 'B': self.pos = 'C' return 2 if self.pos == 'C': self.pos = 'D' return 4 if self.pos == 'D': self.pos = 'E' return 6 if self.pos == 'F': self.pos = 'G' return 9 if self.pos == 'E': self.pos = 'A' return 8 raise KeyError()" "import enum class MilliState(enum.Enum): STATE_A = 0 STATE_B = 1 STATE_C = 2 STATE_D = 3 STATE_E = 4 STATE_F = 5 STATE_G = 6 STATE_H = 7 class Milli: def __init__(self, state): self._state = state def clean(self): if self._state == MilliState.STATE_A: self._state = MilliState.STATE_B return 0 elif self._state == MilliState.STATE_B: self._state = MilliState.STATE_C return 2 elif self._state == MilliState.STATE_C: self._state = MilliState.STATE_D return 3 elif self._state == MilliState.STATE_D: self._state = MilliState.STATE_B return 5 else: raise KeyError def slip(self): if self._state == MilliState.STATE_A: self._state = MilliState.STATE_C return 1 elif self._state == MilliState.STATE_E: self._state = MilliState.STATE_F return 6 else: raise KeyError def boost(self): if self._state == MilliState.STATE_D: self._state = MilliState.STATE_E return 4 elif self._state == MilliState.STATE_E: self._state = MilliState.STATE_B return 7 elif self._state == MilliState.STATE_F: self._state = MilliState.STATE_D return 8 else: raise KeyError def main(): return Milli(MilliState.STATE_A)" "class main: def __init__(self): self.state = 'A' def cue(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'E': return 8 else: raise KeyError def swap(self): if self.state == 'B': self.state = 'C' return 3 elif self.state == 'D': self.state = 'E' return 5 elif self.state == 'E': self.state = 'F' return 7 elif self.state == 'A': self.state = 'F' return 2 else: raise KeyError def begin(self): if self.state == 'A': self.state = 'C' return 1 elif self.state == 'C': self.state = 'D' return 4 elif self.state == 'D': self.state = 'F' return 6 else: raise KeyError" "class FSM: states = dict(A=[[0, 'B'], [1, 'E']], B=[[3, 'B'], [2, 'C']], C=[[9, '-'], [4, 'D']], D=[[9, '-'], [5, 'E']], E=[[7, 'C'], [6, 'F']], F=[[8, 'B'], [9, '-']]) def __init__(self): self.state = 'A' def brake(self): if self.states[self.state][1][1] == '-': raise KeyError else: a = self.states[self.state][1][0] self.state = self.states[self.state][1][1] return a def stand(self): if self.states[self.state][0][1] == '-': raise KeyError else: a = self.states[self.state][0][0] self.state = self.states[self.state][0][1] return a def main(): obj = FSM() return obj" "class main: def __init__(self): self._state = 'A' def rev(self): if self._state == 'A': return 1 elif self._state == 'D': self._state = 'E' return 4 elif self._state == 'E': self._state = 'F' return 7 elif self._state == 'F': return 8 else: raise KeyError def sit(self): if self._state == 'A': self._state = 'B' return 0 elif self._state == 'B': self._state = 'C' return 2 elif self._state == 'C': self._state = 'D' return 3 elif self._state == 'D': return 6 else: raise KeyError def chalk(self): if self._state == 'D': self._state = 'F' return 5 else: raise KeyError" "class Miles_FSM: def __init__(self): self.state = 'A' def log(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 1 elif self.state == 'C': self.state = 'D' return 2 elif self.state == 'E': self.state = 'G' return 5 elif self.state == 'F': self.state = 'A' return 8 else: raise KeyError def start(self): if self.state == 'D': self.state = 'E' return 3 elif self.state == 'E': self.state = 'B' return 6 elif self.state == 'F': self.state = 'G' return 7 else: raise KeyError def merge(self): if self.state == 'E': self.state = 'F' return 4 elif self.state == 'F': self.state = 'F' return 9 else: raise KeyError def main(): obj = Miles_FSM() return obj" "class main: name = 'A' def zoom(self): if self.name == 'A': self.name = 'B' return 0 elif self.name == 'B': self.name = 'C' return 2 elif self.name == 'D': self.name = 'H' return 6 elif self.name == 'G': self.name = 'H' return 10 else: raise KeyError def mass(self): if self.name == 'A': self.name = 'F' return 1 elif self.name == 'H': self.name = 'B' return 11 else: raise KeyError def group(self): if self.name == 'B': self.name = 'D' return 3 elif self.name == 'C': self.name = 'D' return 4 elif self.name == 'D': self.name = 'E' return 5 elif self.name == 'E': self.name = 'A' return 8 elif self.name == 'F': self.name = 'G' return 9 else: raise KeyError def loop(self): if self.name == 'E': self.name = 'F' return 7 else: raise KeyError" "class main: def __init__(self): self.state = 'A' def dash(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 1 elif self.state == 'C': self.state = 'F' return 4 elif self.state == 'E': self.state = 'F' return 6 elif self.state == 'F': self.state = 'G' return 7 else: raise KeyError def stash(self): if self.state == 'C': self.state = 'D' return 3 elif self.state == 'D': self.state = 'E' return 5 elif self.state == 'B': self.state = 'E' return 2 elif self.state == 'F': self.state = 'D' return 8 elif self.state == 'G': self.state = 'G' return 9 else: raise KeyError" "def main(): class main: def __init__(self): self.counter = 4 def cull(self): if self.counter == 4: self.counter = 0 return self.counter elif self.counter == 0: self.counter = 1 return self.counter elif self.counter == 1 or self.counter == 8: self.counter = 2 return self.counter elif self.counter == 2 or self.counter == 7: self.counter = 4 return self.counter raise KeyError def pull(self): if self.counter == 2 or self.counter == 7: self.counter = 3 return self.counter elif self.counter == 5: self.counter = 7 return self.counter elif self.counter == 6 or self.counter == 9: self.counter = 8 return self.counter raise KeyError def slip(self): if self.counter == 3: self.counter = 5 return self.counter elif self.counter == 5: self.counter = 6 return self.counter elif self.counter == 6 or self.counter == 9: self.counter = 9 return self.counter raise KeyError return main()" "class GraphVertex: def __init__(self, has_fork, has_get, has_begin, value_fork, value_get, value_begin, next_fork, next_get, next_begin): self.has_fork = has_fork self.has_get = has_get self.has_begin = has_begin self.value_fork = value_fork self.value_get = value_get self.value_begin = value_begin self.next_fork = next_fork self.next_get = next_get self.next_begin = next_begin class Graph: def __init__(self, root): self.current_vertex = root def fork(self): if self.current_vertex.has_fork: value = self.current_vertex.value_fork self.current_vertex = self.current_vertex.next_fork return value else: raise KeyError def get(self): if self.current_vertex.has_get: value = self.current_vertex.value_get self.current_vertex = self.current_vertex.next_get return value else: raise KeyError def begin(self): if self.current_vertex.has_begin: value = self.current_vertex.value_begin self.current_vertex = self.current_vertex.next_begin return value else: raise KeyError def main(): vertex7 = GraphVertex(False, True, False, None, 11, None, None, None, None) vertex6 = GraphVertex(True, True, True, 8, 9, 10, vertex7, None, None) vertex5 = GraphVertex(True, False, False, 7, None, None, vertex6, None, None) vertex4 = GraphVertex(True, True, False, 6, 5, None, None, vertex5, None) vertex4.next_fork = vertex4 vertex3 = GraphVertex(False, False, True, None, None, 4, None, None, vertex4) vertex2 = GraphVertex(False, False, True, None, None, 3, None, None, vertex3) vertex1 = GraphVertex(False, True, True, None, 2, 1, None, None, vertex2) vertex1.next_get = vertex1 vertex0 = GraphVertex(True, False, False, 0, None, None, vertex1, None, None) vertex6.next_begin = vertex1 vertex6.next_get = vertex3 vertex7.next_get = vertex1 return Graph(vertex0)" "class main: def __init__(self): self.__state = 'A' def scale(self): if self.__state == 'A': self.__state = 'B' return 0 if self.__state == 'B': self.__state = 'C' return 1 if self.__state == 'E': return 8 if self.__state == 'F': self.__state = 'G' return 9 if self.__state == 'C': self.__state = 'G' return 5 raise KeyError def drag(self): if self.__state == 'B': self.__state = 'E' return 2 if self.__state == 'C': self.__state = 'D' return 3 if self.__state == 'D': self.__state = 'E' return 6 raise KeyError def tag(self): if self.__state == 'C': return 4 if self.__state == 'E': self.__state = 'F' return 7 raise KeyError" "class main: def __init__(self): self.currentPoint = 'A' def fetch(self): match self.currentPoint: case 'A': self.currentPoint = 'B' return 0 case 'B': self.currentPoint = 'D' return 5 case 'C': self.currentPoint = 'D' return 6 case 'H': self.currentPoint = 'F' return 11 case _: raise KeyError def widen(self): match self.currentPoint: case 'A': self.currentPoint = 'D' return 1 case 'B': self.currentPoint = 'C' return 3 case 'D': self.currentPoint = 'E' return 7 case 'E': self.currentPoint = 'F' return 8 case _: raise KeyError def snap(self): match self.currentPoint: case 'A': self.currentPoint = 'G' return 2 case 'B': self.currentPoint = 'H' return 4 case 'F': self.currentPoint = 'G' return 9 case 'G': self.currentPoint = 'H' return 10 case _: raise KeyError" "class FSM: states = dict(A=[[0, 'B'], [1, '-']], B=[[1, 'C'], [2, 'B']], C=[[9, '-'], [3, 'D']], D=[[5, 'D'], [4, 'E']], E=[[6, 'F'], [7, 'B']], F=[[8, '-'], [8, 'B']]) def __init__(self): self.state = 'A' def punch(self): if self.states[self.state][1][1] == '-': raise KeyError else: a = self.states[self.state][1][0] self.state = self.states[self.state][1][1] return a def slip(self): if self.states[self.state][0][1] == '-': raise KeyError else: a = self.states[self.state][0][0] self.state = self.states[self.state][0][1] return a def main(): obj = FSM() return obj" "class GreenMile: def __init__(self): self.ways = {'A': {'stand': (1, 'A'), 'melt': (0, 'B')}, 'B': {'melt': (2, 'C')}, 'C': {'melt': (3, 'D')}, 'D': {'melt': (4, 'E'), 'cast': (5, 'A')}, 'E': {'melt': (8, 'C'), 'stand': (7, 'A'), 'cast': (6, 'F')}} self.current = 'A' def move(self, method): number = self.ways[self.current][method][0] self.current = self.ways[self.current][method][1] return number def stand(self): return self.move('stand') def melt(self): return self.move('melt') def cast(self): return self.move('cast') def main(): return GreenMile()" "class Miles: def __init__(self): self.A = 'A' self.B = 'B' self.C = 'C' self.D = 'D' self.E = 'E' self.F = 'F' self.G = 'G' self.H = 'H' self.start = self.A self.current = self.start def amble(self): if self.current == self.C: self.current = self.E return 4 elif self.current == self.G: self.current = self.E return 10 else: raise KeyError def rush(self): if self.current == self.B: self.current = self.C return 1 elif self.current == self.C: self.current = self.D return 2 elif self.current == self.D: self.current = self.E return 5 elif self.current == self.E: self.current = self.F return 6 elif self.current == self.F: self.current = self.G return 7 elif self.current == self.G: self.current = self.C return 11 else: raise KeyError def race(self): if self.current == self.A: self.current = self.B return 0 elif self.current == self.C: self.current = self.F return 3 elif self.current == self.F: self.current = self.H return 8 elif self.current == self.G: self.current = self.H return 9 else: raise KeyError def main(): state_machine = Miles() return state_machine" "class main: def __init__(self): self._state = 'A' self._graph = {('A', 'stall'): ('B', 0), ('B', 'split'): ('C', 1), ('B', 'stall'): ('D', 3), ('B', 'pose'): ('E', 2), ('C', 'split'): ('C', 5), ('C', 'stall'): ('D', 4), ('D', 'split'): ('E', 6), ('E', 'pose'): ('F', 7), ('E', 'stall'): ('C', 8), ('F', 'pose'): ('G', 9)} def split(self): (self._state, ret) = self._graph[self._state, 'split'] return ret def stall(self): (self._state, ret) = self._graph[self._state, 'stall'] return ret def pose(self): (self._state, ret) = self._graph[self._state, 'pose'] return ret" "class main: def __init__(self): self._state = 'A' self._graph = {('A', 'jog'): ('B', 0), ('B', 'jog'): ('C', 1), ('C', 'jog'): ('D', 2), ('C', 'flip'): ('E', 3), ('D', 'flip'): ('E', 4), ('D', 'jog'): ('F', 5), ('E', 'flip'): ('F', 6), ('E', 'jog'): ('E', 7), ('F', 'flip'): ('B', 8)} def flip(self): (self._state, flip) = self._graph[self._state, 'flip'] return flip def jog(self): (self._state, jog) = self._graph[self._state, 'jog'] return jog" "class main: def __init__(self): self._state = 'A' self._graph = {('A', 'begin'): ('B', 0), ('A', 'link'): ('D', 1), ('B', 'chalk'): ('C', 2), ('C', 'link'): ('D', 3), ('D', 'link'): ('B', 5), ('D', 'chalk'): ('E', 4), ('E', 'chalk'): ('F', 6), ('F', 'chalk'): ('A', 9), ('F', 'begin'): ('F', 8), ('F', 'link'): ('G', 7), ('G', 'begin'): ('E', 11), ('G', 'chalk'): ('H', 10)} def begin(self): (self._state, ret) = self._graph[self._state, 'begin'] return ret def link(self): (self._state, ret) = self._graph[self._state, 'link'] return ret def chalk(self): (self._state, ret) = self._graph[self._state, 'chalk'] return ret" "import enum class MilliState(enum.Enum): STATE_A = 0 STATE_B = 1 STATE_C = 2 STATE_D = 3 STATE_E = 4 STATE_F = 5 class Milli: def __init__(self, state): self._state = state def stall(self): if self._state == MilliState.STATE_A: self._state = MilliState.STATE_B return 0 elif self._state == MilliState.STATE_B: self._state = MilliState.STATE_C return 2 elif self._state == MilliState.STATE_E: self._state = MilliState.STATE_E return 8 else: raise KeyError def coat(self): if self._state == MilliState.STATE_A: self._state = MilliState.STATE_F return 1 elif self._state == MilliState.STATE_C: self._state = MilliState.STATE_D return 4 elif self._state == MilliState.STATE_D: self._state = MilliState.STATE_E return 5 elif self._state == MilliState.STATE_E: self._state = MilliState.STATE_C return 7 else: raise KeyError def rock(self): if self._state == MilliState.STATE_B: self._state = MilliState.STATE_F return 3 elif self._state == MilliState.STATE_E: self._state = MilliState.STATE_F return 6 else: raise KeyError def main(): return Milli(MilliState.STATE_A)" "import enum class MilliState(enum.Enum): STATE_A = 0 STATE_B = 1 STATE_C = 2 STATE_D = 3 STATE_E = 4 STATE_F = 5 STATE_G = 6 STATE_H = 7 class Milli: def __init__(self, state): self._state = state def play(self): if self._state == MilliState.STATE_A: self._state = MilliState.STATE_B return 0 elif self._state == MilliState.STATE_C: self._state = MilliState.STATE_H return 3 elif self._state == MilliState.STATE_D: self._state = MilliState.STATE_E return 4 elif self._state == MilliState.STATE_E: self._state = MilliState.STATE_B return 7 elif self._state == MilliState.STATE_F: self._state = MilliState.STATE_C return 10 elif self._state == MilliState.STATE_G: self._state = MilliState.STATE_H return 11 else: raise KeyError def amble(self): if self._state == MilliState.STATE_B: self._state = MilliState.STATE_C return 1 elif self._state == MilliState.STATE_F: self._state = MilliState.STATE_B return 9 else: raise KeyError def glare(self): if self._state == MilliState.STATE_C: self._state = MilliState.STATE_D return 2 elif self._state == MilliState.STATE_D: self._state = MilliState.STATE_H return 5 elif self._state == MilliState.STATE_E: self._state = MilliState.STATE_F return 6 elif self._state == MilliState.STATE_F: self._state = MilliState.STATE_G return 8 else: raise KeyError def main(): return Milli(MilliState.STATE_A)" "class MilesFSM: def __init__(self): self.state = 'A' def apply(self): if self.state == 'A': self.state = 'A' return 1 elif self.state == 'C': self.state = 'D' return 5 elif self.state == 'D': self.state = 'B' return 7 elif self.state == 'B': self.state = 'F' return 3 else: raise KeyError def reset(self): if self.state == 'B': self.state = 'C' return 2 elif self.state == 'D': self.state = 'E' return 6 elif self.state == 'E': self.state = 'F' return 8 else: raise KeyError def mass(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'E' return 4 else: raise KeyError def main(): obj = MilesFSM() return obj" "class main: def __init__(self): self._state = 'A' self._graph = {('A', 'etch'): ('B', 0), ('A', 'rock'): ('G', 1), ('B', 'etch'): ('G', 3), ('B', 'file'): ('D', 4), ('B', 'rock'): ('C', 2), ('C', 'etch'): ('A', 6), ('C', 'file'): ('D', 5), ('D', 'file'): ('E', 7), ('E', 'file'): ('F', 8), ('F', 'etch'): ('G', 9), ('G', 'file'): ('H', 10), ('H', 'etch'): ('C', 11)} def etch(self): (self._state, sim) = self._graph[self._state, 'etch'] return sim def rock(self): (self._state, sim) = self._graph[self._state, 'rock'] return sim def file(self): (self._state, sim) = self._graph[self._state, 'file'] return sim" "import enum class MilliState(enum.Enum): STATE_A = 0 STATE_B = 1 STATE_C = 2 STATE_D = 3 STATE_E = 4 STATE_F = 5 class MilliNikita: def __init__(self, state): self._state = state def rev(self): if self._state == MilliState.STATE_A: self._state = MilliState.STATE_B return 0 elif self._state == MilliState.STATE_B: self._state = MilliState.STATE_C return 1 elif self._state == MilliState.STATE_D: self._state = MilliState.STATE_A return 6 else: raise KeyError def sort(self): if self._state == MilliState.STATE_C: self._state = MilliState.STATE_D return 2 elif self._state == MilliState.STATE_D: self._state = MilliState.STATE_F return 7 else: raise KeyError def boost(self): if self._state == MilliState.STATE_D: self._state = MilliState.STATE_B return 4 else: raise KeyError def stop(self): if self._state == MilliState.STATE_D: self._state = MilliState.STATE_E return 3 elif self._state == MilliState.STATE_E: self._state = MilliState.STATE_F return 8 else: raise KeyError def stand(self): if self._state == MilliState.STATE_D: return 5 else: raise KeyError def main(): return MilliNikita(MilliState.STATE_A)" "class main: def __init__(self): self._state = 'A' self._graph = {('A', 'shift'): ('B', 0), ('B', 'push'): ('C', 1), ('B', 'shift'): ('D', 2), ('B', 'sway'): ('E', 3), ('C', 'shift'): ('C', 5), ('C', 'push'): ('D', 4), ('D', 'shift'): ('A', 7), ('D', 'sway'): ('E', 6), ('E', 'shift'): ('F', 8)} def shift(self): (self._state, ret) = self._graph[self._state, 'shift'] return ret def push(self): (self._state, ret) = self._graph[self._state, 'push'] return ret def sway(self): (self._state, ret) = self._graph[self._state, 'sway'] return ret" "class main: def __init__(self): self._state = 'A' self._graph = {('A', 'spin'): ('B', 0), ('A', 'link'): ('E', 1), ('B', 'link'): ('C', 2), ('B', 'spin'): ('E', 3), ('D', 'spin'): ('B', 6), ('D', 'link'): ('E', 5), ('E', 'spin'): ('F', 7), ('F', 'spin'): ('C', 8), ('C', 'link'): ('D', 4)} def spin(self): (self._state, ret) = self._graph[self._state, 'spin'] return ret def link(self): (self._state, ret) = self._graph[self._state, 'link'] return ret" "class main: def __init__(self): self._state = 'A' self._graph = {('A', 'color'): ('B', 0), ('B', 'drive'): ('B', 2), ('B', 'color'): ('C', 1), ('C', 'color'): ('D', 3), ('D', 'color'): ('E', 4), ('D', 'drive'): ('F', 5), ('E', 'color'): ('F', 6), ('F', 'color'): ('G', 7), ('G', 'drive'): ('D', 8), ('G', 'color'): ('C', 9)} def color(self): (self._state, ret) = self._graph[self._state, 'color'] return ret def drive(self): (self._state, ret) = self._graph[self._state, 'drive'] return ret" "class main: def __init__(self): self._state = 'A' self._graph = {('A', 'etch'): ('B', 0), ('A', 'code'): ('C', 1), ('A', 'color'): ('D', 2), ('B', 'etch'): ('C', 3), ('C', 'etch'): ('D', 4), ('D', 'etch'): ('E', 5), ('D', 'color'): ('F', 7), ('D', 'code'): ('H', 6), ('E', 'etch'): ('G', 9), ('E', 'color'): ('F', 8), ('F', 'color'): ('G', 10), ('G', 'color'): ('H', 11)} def etch(self): (self._state, ret) = self._graph[self._state, 'etch'] return ret def code(self): (self._state, ret) = self._graph[self._state, 'code'] return ret def color(self): (self._state, ret) = self._graph[self._state, 'color'] return ret" "class main: def __init__(self): self._state = 'A' self._graph = {('A', 'throw'): ('A', 1), ('A', 'chain'): ('B', 0), ('B', 'throw'): ('C', 2), ('C', 'chain'): ('D', 3), ('D', 'rig'): ('E', 4), ('E', 'chain'): ('F', 5), ('F', 'rig'): ('D', 8), ('F', 'throw'): ('G', 6), ('F', 'chain'): ('A', 7), ('G', 'throw'): ('E', 9)} def throw(self): (self._state, ret) = self._graph[self._state, 'throw'] return ret def chain(self): (self._state, ret) = self._graph[self._state, 'chain'] return ret def rig(self): (self._state, ret) = self._graph[self._state, 'rig'] return ret" "class main: state = 0 def __init__(self): self.state = 10 def reset(self): if self.state == 3: self.state = 1 return self.state elif self.state == 0 or self.state == 10: self.state = 3 return 0 elif self.state == 1: self.state = 5 return self.state elif self.state == 5: self.state = 5 return self.state else: raise KeyError() def fill(self): if self.state == 0: self.state = 3 return self.state elif self.state == 3: self.state = 3 return self.state elif self.state == 5: self.state = 4 return self.state else: raise KeyError() def drag(self): if self.state == 3: self.state = 2 return self.state elif self.state == 4: self.state = 7 return self.state elif self.state == 7: self.state = 8 return self.state elif self.state == 5: self.state = 6 return self.state else: raise KeyError()" "class main: def __init__(self): self._state = 'A' self._graph = {('A', 'link'): ('B', 0), ('A', 'throw'): ('E', 1), ('B', 'link'): ('F', 3), ('B', 'throw'): ('C', 2), ('C', 'link'): ('D', 4), ('D', 'link'): ('B', 6), ('D', 'throw'): ('E', 5), ('E', 'link'): ('F', 7), ('F', 'link'): ('C', 8)} def link(self): (self._state, ret) = self._graph[self._state, 'link'] return ret def throw(self): (self._state, ret) = self._graph[self._state, 'throw'] return ret" "class main: def __init__(self): self._state = 'A' self._graph = {('A', 'march'): ('B', 0), ('B', 'march'): ('D', 2), ('F', 'march'): ('C', 6), ('B', 'pose'): ('C', 1), ('D', 'pose'): ('E', 4), ('E', 'pose'): ('F', 5), ('F', 'pose'): ('B', 7), ('C', 'sort'): ('D', 3), ('F', 'sort'): ('D', 8)} def march(self): (self._state, ret) = self._graph[self._state, 'march'] return ret def pose(self): (self._state, ret) = self._graph[self._state, 'pose'] return ret def sort(self): (self._state, ret) = self._graph[self._state, 'sort'] return ret" "class main: def __init__(self): self._state = 'A' self._graph = {('A', 'init'): ('B', 0), ('B', 'init'): ('C', 1), ('C', 'crawl'): ('C', 3), ('C', 'init'): ('D', 2), ('C', 'make'): ('F', 4), ('D', 'make'): ('G', 6), ('D', 'init'): ('E', 5), ('F', 'init'): ('G', 9), ('E', 'make'): ('C', 8), ('E', 'crawl'): ('F', 7)} def init(self): (self._state, ret) = self._graph[self._state, 'init'] return ret def crawl(self): (self._state, ret) = self._graph[self._state, 'crawl'] return ret def make(self): (self._state, ret) = self._graph[self._state, 'make'] return ret" "class main: def __init__(self): self._state = 'A' self._graph = {('A', 'glare'): ('B', 0), ('A', 'chat'): ('C', 2), ('A', 'model'): ('G', 1), ('B', 'chat'): ('C', 3), ('C', 'model'): ('D', 4), ('D', 'model'): ('E', 5), ('D', 'glare'): ('H', 6), ('E', 'chat'): ('F', 7), ('F', 'model'): ('C', 10), ('E', 'model'): ('B', 8), ('G', 'model'): ('H', 11), ('F', 'glare'): ('G', 9)} def model(self): (self._state, ret) = self._graph[self._state, 'model'] return ret def glare(self): (self._state, ret) = self._graph[self._state, 'glare'] return ret def chat(self): (self._state, ret) = self._graph[self._state, 'chat'] return ret" "class main: def __init__(self): self._state = 'A' self._graph = {('A', 'hurry'): ('B', 0), ('B', 'draw'): ('C', 1), ('B', 'get'): ('D', 2), ('C', 'draw'): ('D', 3), ('D', 'hurry'): ('E', 4), ('D', 'draw'): ('G', 6), ('D', 'get'): ('A', 5), ('E', 'draw'): ('E', 8), ('E', 'get'): ('F', 7), ('F', 'get'): ('F', 9)} def hurry(self): (self._state, ret) = self._graph[self._state, 'hurry'] return ret def get(self): (self._state, ret) = self._graph[self._state, 'get'] return ret def draw(self): (self._state, ret) = self._graph[self._state, 'draw'] return ret" "class main: def __init__(self): self._state = 'A' self._graph = {('A', 'shift'): ('B', 0), ('B', 'shift'): ('C', 2), ('C', 'shift'): ('D', 3), ('C', 'sway'): ('F', 4), ('F', 'shift'): ('B', 8), ('D', 'sway'): ('E', 5), ('E', 'sway'): ('F', 6), ('E', 'shift'): ('A', 7), ('A', 'sway'): ('F', 1)} def shift(self): (self._state, ret) = self._graph[self._state, 'shift'] return ret def sway(self): (self._state, ret) = self._graph[self._state, 'sway'] return ret" "class main: def __init__(self): self._state = 'A' self._graph = {('A', 'copy'): ('B', 0), ('B', 'get'): ('C', 1), ('B', 'copy'): ('G', 2), ('B', 'amass'): ('E', 3), ('C', 'copy'): ('D', 4), ('D', 'amass'): ('E', 5), ('E', 'get'): ('A', 7), ('E', 'copy'): ('F', 6), ('F', 'amass'): ('G', 8), ('F', 'get'): ('F', 9)} def copy(self): (self._state, ret) = self._graph[self._state, 'copy'] return ret def get(self): (self._state, ret) = self._graph[self._state, 'get'] return ret def amass(self): (self._state, ret) = self._graph[self._state, 'amass'] return ret" "class main: def __init__(self): self._state = 'A' self._graph = {('A', 'carve'): ('A', 2), ('A', 'walk'): ('B', 0), ('A', 'slur'): ('C', 1), ('B', 'slur'): ('C', 3), ('C', 'slur'): ('D', 4), ('D', 'carve'): ('E', 5), ('E', 'carve'): ('F', 6), ('F', 'carve'): ('G', 7), ('G', 'carve'): ('D', 9), ('G', 'slur'): ('A', 8)} def carve(self): (self._state, ret) = self._graph[self._state, 'carve'] return ret def walk(self): (self._state, ret) = self._graph[self._state, 'walk'] return ret def slur(self): (self._state, ret) = self._graph[self._state, 'slur'] return ret" "class main: def __init__(self): self._state = 'A' self._graph = {('A', 'mass'): ('B', 0), ('A', 'slip'): ('D', 1), ('A', 'skew'): ('F', 2), ('B', 'mass'): ('C', 3), ('C', 'skew'): ('D', 4), ('C', 'slip'): ('F', 5), ('D', 'mass'): ('E', 6), ('E', 'mass'): ('F', 7), ('F', 'slip'): ('G', 8), ('G', 'slip'): ('C', 9)} def mass(self): (self._state, ret) = self._graph[self._state, 'mass'] return ret def slip(self): (self._state, ret) = self._graph[self._state, 'slip'] return ret def skew(self): (self._state, ret) = self._graph[self._state, 'skew'] return ret" "class main: def __init__(self): self._state = 'A' self._graph = {('A', 'trace'): ('B', 0), ('B', 'trace'): ('C', 2), ('C', 'color'): ('D', 3), ('D', 'trace'): ('D', 6), ('D', 'color'): ('E', 4), ('E', 'trace'): ('F', 7), ('F', 'color'): ('G', 8), ('G', 'paint'): ('H', 10), ('H', 'paint'): ('H', 11), ('A', 'paint'): ('F', 1), ('D', 'paint'): ('F', 5), ('F', 'trace'): ('H', 9)} def trace(self): (self._state, ret) = self._graph[self._state, 'trace'] return ret def color(self): (self._state, ret) = self._graph[self._state, 'color'] return ret def paint(self): (self._state, ret) = self._graph[self._state, 'paint'] return ret" "class main: def __init__(self): self._state = 'A' self._graph = {('A', 'bolt'): ('A', 1), ('A', 'join'): ('B', 0), ('B', 'bolt'): ('D', 3), ('B', 'join'): ('C', 2), ('C', 'join'): ('D', 4), ('D', 'bolt'): ('E', 5), ('E', 'bolt'): ('B', 7), ('E', 'join'): ('F', 6), ('F', 'bolt'): ('A', 8)} def bolt(self): (self._state, ret) = self._graph[self._state, 'bolt'] return ret def join(self): (self._state, ret) = self._graph[self._state, 'join'] return ret" "class main: def __init__(self): self._state = 'A' self._graph = {('A', 'add'): ('B', 0), ('B', 'add'): ('C', 1), ('C', 'add'): ('D', 2), ('C', 'patch'): ('C', 3), ('D', 'add'): ('E', 4), ('E', 'add'): ('F', 5), ('E', 'patch'): ('C', 6), ('F', 'add'): ('G', 7), ('F', 'patch'): ('F', 8), ('G', 'add'): ('A', 9)} def add(self): (self._state, ret) = self._graph[self._state, 'add'] return ret def patch(self): (self._state, ret) = self._graph[self._state, 'patch'] return ret" "class main: def __init__(self): self._state = 'A' self._graph = {('A', 'spawn'): ('B', 0), ('B', 'view'): ('C', 1), ('C', 'add'): ('D', 2), ('E', 'add'): ('C', 7), ('C', 'spawn'): ('F', 3), ('D', 'view'): ('D', 5), ('D', 'add'): ('E', 4), ('E', 'spawn'): ('F', 6), ('F', 'spawn'): ('D', 8)} def spawn(self): (self._state, ret) = self._graph[self._state, 'spawn'] return ret def view(self): (self._state, ret) = self._graph[self._state, 'view'] return ret def add(self): (self._state, ret) = self._graph[self._state, 'add'] return ret" "from enum import Enum class State(Enum): A = 1 B = 2 C = 3 D = 4 E = 5 F = 6 G = 7 class main: def __init__(self): self.__state = State.A def tag(self) -> int: match self.__state: case State.A: self.__state = State.B return 0 case State.B: self.__state = State.C return 1 case State.D: self.__state = State.D return 6 case State.E: self.__state = State.F return 7 case State.F: self.__state = State.G return 9 raise KeyError def rush(self) -> int: match self.__state: case State.C: self.__state = State.A return 4 case State.B: self.__state = State.E return 2 case State.E: self.__state = State.A return 8 raise KeyError def exit(self) -> int: match self.__state: case State.C: self.__state = State.D return 3 case State.D: self.__state = State.E return 5 raise KeyError" "class main: def __init__(self): self.pos = 'A' def solve(self, dct): if self.pos in dct: ret = dct[self.pos][1] self.pos = dct[self.pos][0] return ret raise KeyError def cut(self): return self.solve({'A': ['B', 0], 'B': ['C', 2], 'C': ['C', 4], 'D': ['E', 5], 'E': ['F', 7]}) def grow(self): return self.solve({'A': ['A', 1], 'C': ['D', 3], 'D': ['D', 6], 'F': ['A', 8]})" "class MILI: def __init__(self): self.A = 'A' self.B = 'B' self.C = 'C' self.D = 'D' self.E = 'E' self.F = 'F' self.curSt = self.A def chip(self): if self.curSt == self.A: self.curSt = self.B return 0 elif self.curSt == self.E: self.curSt = self.F return 5 elif self.curSt == self.F: self.curSt = self.C return 7 else: raise KeyError def rush(self): if self.curSt == self.A: self.curSt = self.E return 1 elif self.curSt == self.B: self.curSt = self.C return 2 elif self.curSt == self.F: self.curSt = self.D return 6 else: raise KeyError def exit(self): if self.curSt == self.C: self.curSt = self.D return 3 elif self.curSt == self.D: self.curSt = self.E return 4 elif self.curSt == self.F: self.curSt = self.F return 8 else: raise KeyError def main(): return MILI()" "class Mili: def __init__(self): self.state = 'A' def speed(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'D' return 2 elif self.state == 'C': self.state = 'A' return 4 elif self.state == 'D': self.state = 'E' return 5 elif self.state == 'E': self.state = 'F' return 6 elif self.state == 'F': self.state = 'D' return 8 def crawl(self): if self.state == 'B': self.state = 'C' return 1 elif self.state == 'C': self.state = 'D' return 3 elif self.state == 'E': self.state = 'A' return 7 else: raise KeyError def main(): return Mili()" "class main: def __init__(self): self._state = 'A' self._graph = {('A', 'dash'): ('A', 1), ('A', 'spawn'): ('B', 0), ('B', 'tweak'): ('C', 2), ('C', 'tweak'): ('D', 3), ('D', 'spawn'): ('E', 4), ('E', 'spawn'): ('F', 5), ('F', 'tweak'): ('D', 8), ('F', 'spawn'): ('A', 7), ('F', 'dash'): ('G', 6), ('G', 'tweak'): ('A', 9)} def dash(self): (self._state, ret) = self._graph[self._state, 'dash'] return ret def tweak(self): (self._state, ret) = self._graph[self._state, 'tweak'] return ret def spawn(self): (self._state, ret) = self._graph[self._state, 'spawn'] return ret" "class MyClass: state = 'A' dict_chalk = {'A': 'B', 'B': 'C', 'C': 'C', 'D': 'D', 'E': 'C'} dict_visit = {'A': 'F', 'C': 'D', 'D': 'E', 'E': 'F'} dict_chalk_num = {'A': 0, 'B': 2, 'C': 4, 'D': 6, 'E': 8} dict_visit_num = {'A': 1, 'C': 3, 'D': 5, 'E': 7} def __init__(self): self.state = 'A' self.dict_chalk = {'A': 'B', 'B': 'C', 'C': 'C', 'D': 'D', 'E': 'C'} self.dict_visit = {'A': 'F', 'C': 'D', 'D': 'E', 'E': 'F'} self.dict_chalk_num = {'A': 0, 'B': 2, 'C': 4, 'D': 6, 'E': 8} self.dict_visit_num = {'A': 1, 'C': 3, 'D': 5, 'E': 7} def visit(self): ret = self.dict_visit_num.get(self.state) if type(ret) == int: newstate = self.dict_visit.get(self.state) self.state = newstate return ret else: raise KeyError def chalk(self): ret = self.dict_chalk_num.get(self.state) if type(ret) == int: newstate = self.dict_chalk.get(self.state) self.state = newstate return ret else: raise KeyError def main(): return MyClass()" "class main: def __init__(self): self.currentPoint = 'A' def coat(self): match self.currentPoint: case 'A': self.currentPoint = 'B' return 0 case 'B': self.currentPoint = 'C' return 2 case 'E': self.currentPoint = 'C' return 6 case 'D': self.currentPoint = 'E' return 4 case 'F': self.currentPoint = 'G' return 7 case 'G': self.currentPoint = 'D' return 8 case _: raise KeyError def exit(self): match self.currentPoint: case 'A': self.currentPoint = 'F' return 1 case 'E': self.currentPoint = 'F' return 5 case 'G': self.currentPoint = 'E' return 9 case 'C': self.currentPoint = 'D' return 3 case _: raise KeyError" "class Milly: def __init__(self): self.current_state = 'A' self.HOARD = {'A': {'value': 0, 'new_state': 'B'}, 'B': {'value': 2, 'new_state': 'D'}, 'C': {'value': 3, 'new_state': 'D'}, 'D': {'value': 4, 'new_state': 'E'}, 'E': {'value': 5, 'new_state': 'F'}, 'F': {'value': 7, 'new_state': 'A'}} self.HURRY = {'B': {'value': 1, 'new_state': 'C'}, 'C': {'value': 3, 'new_state': 'B'}, 'E': {'value': 6, 'new_state': 'A'}, 'F': {'value': 8, 'new_state': 'D'}} def hoard(self): res = self.HOARD[self.current_state] self.current_state = res['new_state'] return res['value'] def hurry(self): res = self.HURRY[self.current_state] self.current_state = res['new_state'] return res['value'] def main(): return Milly()" "class main: def __init__(self): self._state = 'A' self._graph = {('A', 'join'): ('B', 0), ('B', 'zoom'): ('C', 1), ('B', 'mask'): ('E', 2), ('C', 'zoom'): ('D', 3), ('D', 'mask'): ('E', 4), ('D', 'zoom'): ('F', 5), ('D', 'join'): ('B', 6), ('D', 'rig'): ('A', 7), ('E', 'mask'): ('F', 8)} def join(self): (self._state, ret) = self._graph[self._state, 'join'] return ret def zoom(self): (self._state, ret) = self._graph[self._state, 'zoom'] return ret def mask(self): (self._state, ret) = self._graph[self._state, 'mask'] return ret def rig(self): (self._state, ret) = self._graph[self._state, 'rig'] return ret" "import enum class MilliState(enum.Enum): STATE_A = 0 STATE_B = 1 STATE_C = 2 STATE_D = 3 STATE_E = 4 STATE_F = 5 STATE_G = 6 STATE_H = 7 class Milli: def __init__(self, state): self._state = state def trace(self): if self._state == MilliState.STATE_A: self._state = MilliState.STATE_B return 0 elif self._state == MilliState.STATE_B: self._state = MilliState.STATE_E return 3 elif self._state == MilliState.STATE_D: self._state = MilliState.STATE_B return 6 elif self._state == MilliState.STATE_E: self._state = MilliState.STATE_E return 8 elif self._state == MilliState.STATE_F: self._state = MilliState.STATE_G return 9 elif self._state == MilliState.STATE_G: self._state = MilliState.STATE_H return 10 else: raise KeyError def grow(self): if self._state == MilliState.STATE_A: self._state = MilliState.STATE_A return 1 elif self._state == MilliState.STATE_B: self._state = MilliState.STATE_C return 2 elif self._state == MilliState.STATE_C: self._state = MilliState.STATE_D return 4 elif self._state == MilliState.STATE_D: self._state = MilliState.STATE_E return 5 elif self._state == MilliState.STATE_E: self._state = MilliState.STATE_F return 7 elif self._state == MilliState.STATE_G: self._state = MilliState.STATE_B return 11 else: raise KeyError def main(): return Milli(MilliState.STATE_A)" "class MiliImperative: state = -1 def stare(self): if self.state == -1: self.state = 0 elif self.state == 1: self.state = 3 elif self.state == 3: self.state = 8 elif self.state == 8: self.state = 8 elif self.state == 4: self.state = 5 elif self.state == 6: self.state = 3 elif self.state == 5: self.state = 8 else: raise KeyError return self.state def visit(self): if self.state == 0: self.state = 1 elif self.state == 1: self.state = 2 elif self.state == 2: self.state = 4 elif self.state == 4: self.state = 6 elif self.state == 6: self.state = 2 elif self.state == 8: self.state = 7 elif self.state == 7: self.state = 4 elif self.state == 3: self.state = 7 elif self.state == 5: self.state = 7 else: raise KeyError return self.state def main(): return MiliImperative() o = main()" "class MillyMachine: def __init__(self): self.cond = 'A' def dash(self): if self.cond == 'A': self.cond = 'B' return 0 elif self.cond == 'B': self.cond = 'D' return 4 elif self.cond == 'D': self.cond = 'E' return 7 elif self.cond == 'C': self.cond = 'D' return 6 elif self.cond == 'F': self.cond = 'G' return 9 else: raise KeyError def color(self): if self.cond == 'A': self.cond = 'F' return 2 elif self.cond == 'B': self.cond = 'C' return 3 elif self.cond == 'E': self.cond = 'F' return 8 else: raise KeyError def herd(self): if self.cond == 'A': self.cond = 'D' return 1 elif self.cond == 'B': self.cond = 'F' return 5 else: raise KeyError def main(): o = MillyMachine() return o" "class main: now_letter = 'A' blame_dir = {'A': '0B', 'B': '3E', 'E': '6F'} view_dir = {'A': '1C', 'B': '2C', 'C': '4D', 'D': '5E', 'E': '7C'} drag_dir = {'F': '8A'} def blame(self): tmp_blame = self.now_letter if self.blame_dir.get(tmp_blame, 'KeyError')[1] != 'e': self.now_letter = self.blame_dir.get(tmp_blame, 'KeyError')[1] return int(self.blame_dir.get(tmp_blame)[0]) else: raise KeyError def view(self): tmp_view = self.now_letter if self.view_dir.get(tmp_view, 'KeyError')[1] != 'e': self.now_letter = self.view_dir.get(tmp_view, 'KeyError')[1] return int(self.view_dir.get(tmp_view)[0]) else: raise KeyError def drag(self): tmp_drag = self.now_letter if self.drag_dir.get(tmp_drag, 'KeyError')[1] != 'e': self.now_letter = self.drag_dir.get(tmp_drag, 'KeyError')[1] return int(self.drag_dir.get(tmp_drag)[0]) else: raise KeyError" "class Mili(object): def __init__(self): self.currentPoint = 'A' def rig(self): if self.currentPoint == 'A': self.currentPoint = 'B' return 0 elif self.currentPoint == 'B': self.currentPoint = 'C' return 1 elif self.currentPoint == 'E': self.currentPoint = 'F' return 6 elif self.currentPoint == 'F': self.currentPoint = 'C' return 9 else: raise KeyError def herd(self): if self.currentPoint == 'B': self.currentPoint = 'F' return 2 elif self.currentPoint == 'C': self.currentPoint = 'D' return 3 elif self.currentPoint == 'F': self.currentPoint = 'G' return 8 else: raise KeyError def unite(self): if self.currentPoint == 'D': self.currentPoint = 'E' return 5 elif self.currentPoint == 'E': self.currentPoint = 'C' return 7 elif self.currentPoint == 'C': self.currentPoint = 'G' return 4 else: raise KeyError def main(): return Mili()" "class main: def __init__(self): self.condition = 'A' def post(self): if self.condition == 'A': self.condition = 'B' return 0 elif self.condition == 'B': self.condition = 'B' return 2 elif self.condition == 'D': self.condition = 'F' return 5 elif self.condition == 'F': self.condition = 'C' return 9 elif self.condition == 'E': self.condition = 'G' return 7 else: raise KeyError def melt(self): if self.condition == 'B': self.condition = 'C' return 1 elif self.condition == 'C': self.condition = 'D' return 3 elif self.condition == 'D': self.condition = 'E' return 4 elif self.condition == 'E': self.condition = 'F' return 6 elif self.condition == 'F': self.condition = 'G' return 8 else: raise KeyError" "class main: point = 'A' file1 = {'A': '0B', 'B': '2C', 'E': '7G', 'G': '9A'} put1 = {'A': '1F', 'C': '3D'} rock1 = {'C': '4G', 'D': '5E', 'E': '6F', 'F': '8G'} def file(self): tmp_blame = self.point if self.file1.get(tmp_blame, 'KeyError')[1] != 'e': self.point = self.file1.get(tmp_blame, 'KeyError')[1] return int(self.file1.get(tmp_blame)[0]) else: raise KeyError def put(self): tmp_view = self.point if self.put1.get(tmp_view, 'KeyError')[1] != 'e': self.point = self.put1.get(tmp_view, 'KeyError')[1] return int(self.put1.get(tmp_view)[0]) else: raise KeyError def rock(self): tmp_drag = self.point if self.rock1.get(tmp_drag, 'KeyError')[1] != 'e': self.point = self.rock1.get(tmp_drag, 'KeyError')[1] return int(self.rock1.get(tmp_drag)[0]) else: raise KeyError" "class Miles_FSM: def __init__(self): self.state = 'A' def brake(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'C': self.state = 'D' return 3 elif self.state == 'D': self.state = 'E' return 5 elif self.state == 'F': self.state = 'D' return 8 else: raise KeyError def order(self): if self.state == 'A': self.state = 'C' return 1 elif self.state == 'B': self.state = 'C' return 2 elif self.state == 'C': self.state = 'C' return 4 elif self.state == 'D': self.state = 'D' return 6 elif self.state == 'E': self.state = 'F' return 7 else: raise KeyError def main(): obj = Miles_FSM() return obj" "class Miles_FSM: def __init__(self): self.state = 'A' def pluck(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 1 elif self.state == 'C': self.state = 'D' return 2 elif self.state == 'F': self.state = 'A' return 8 elif self.state == 'E': self.state = 'B' return 6 elif self.state == 'D': self.state = 'G' return 4 else: raise KeyError def rush(self): if self.state == 'F': self.state = 'G' return 7 elif self.state == 'E': self.state = 'F' return 5 elif self.state == 'G': self.state = 'B' return 9 elif self.state == 'D': self.state = 'E' return 3 else: raise KeyError def main(): obj = Miles_FSM() return obj" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 7 class StateMachine: state = State.A def rush(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 1], State.E: [State.G, 5], State.F: [State.G, 6], State.G: [State.C, 9]}) def warp(self): return self.update({State.C: [State.D, 2], State.D: [State.E, 3], State.G: [State.D, 8]}) def turn(self): return self.update({State.E: [State.F, 4], State.F: [State.F, 7]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class Mealy: state = 'A' def group(self): if self.state == 'A': self.state = 'A' return 1 if self.state == 'F': self.state = 'A' return 8 if self.state == 'G': self.state = 'H' return 9 if self.state == 'H': self.state = 'E' return 10 raise KeyError def chain(self): if self.state == 'A': self.state = 'B' return 0 if self.state == 'C': self.state = 'D' return 3 if self.state == 'E': self.state = 'F' return 5 if self.state == 'F': self.state = 'C' return 7 raise KeyError def tail(self): if self.state == 'B': self.state = 'C' return 2 if self.state == 'D': self.state = 'E' return 4 if self.state == 'F': self.state = 'G' return 6 if self.state == 'H': self.state = 'B' return 11 raise KeyError def main(): o = Mealy() return o o = main()" "class main(object): def __init__(self): self.status = 'A' def snap(self): match self.status: case 'A': self.status = 'B' return 0 case 'C': self.status = 'D' return 2 case 'D': self.status = 'E' return 3 case 'E': self.status = 'F' return 5 case 'F': self.status = 'F' return 7 case _: raise KeyError def begin(self): match self.status: case 'B': self.status = 'C' return 1 case 'D': self.status = 'F' return 4 case 'E': self.status = 'E' return 6 case 'F': self.status = 'C' return 8 case _: raise KeyError" "def main(): class Omg: def __init__(self): self.state = 'A' def code(self): if self.state == 'A': self.state = 'B' return 0 if self.state == 'C': self.state = 'D' return 5 raise KeyError def rev(self): if self.state == 'A': self.state = 'F' return 1 if self.state == 'B': self.state = 'C' return 3 if self.state == 'E': self.state = 'F' return 7 if self.state == 'F': self.state = 'B' return 9 if self.state == 'G': self.state = 'H' return 10 raise KeyError def slip(self): if self.state == 'A': self.state = 'G' return 2 if self.state == 'G': self.state = 'B' return 11 if self.state == 'B': self.state = 'E' return 4 if self.state == 'D': self.state = 'E' return 6 if self.state == 'F': self.state = 'G' return 8 raise KeyError return Omg()" "class Miles_FSM: def __init__(self): self.state = 'A' def stall(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'D': self.state = 'A' return 6 elif self.state == 'C': self.state = 'F' return 3 elif self.state == 'E': self.state = 'F' return 7 else: raise KeyError def slog(self): if self.state == 'C': self.state = 'D' return 2 elif self.state == 'F': self.state = 'G' return 8 else: raise KeyError def turn(self): if self.state == 'B': self.state = 'C' return 1 elif self.state == 'C': self.state = 'E' return 4 elif self.state == 'D': self.state = 'E' return 5 elif self.state == 'F': self.state = 'A' return 9 else: raise KeyError def main(): obj = Miles_FSM() return obj" "class Miles_FSM: def __init__(self): self.state = 'A' def clean(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'C': self.state = 'F' return 4 elif self.state == 'B': self.state = 'E' return 2 elif self.state == 'D': self.state = 'D' return 6 elif self.state == 'F': self.state = 'F' return 8 else: raise KeyError def daub(self): if self.state == 'B': self.state = 'C' return 1 elif self.state == 'C': self.state = 'D' return 3 elif self.state == 'D': self.state = 'E' return 5 elif self.state == 'E': self.state = 'F' return 7 else: raise KeyError def main(): obj = Miles_FSM() return obj" "class Node: def __init__(self): self.data = None self.status = 'A' def flip(self): if self.status == 'A': self.data = 0 self.status = 'B' elif self.status == 'B': self.data = 2 elif self.status == 'C': self.data = 5 self.status = 'A' elif self.status == 'D': self.data = 6 self.status = 'E' else: raise KeyError return self.data def carve(self): if self.status == 'B': self.data = 1 self.status = 'C' elif self.status == 'C': self.data = 3 self.status = 'D' elif self.status == 'F': self.data = 8 self.status = 'D' elif self.status == 'E': self.data = 7 self.status = 'F' else: raise KeyError return self.data def jog(self): if self.status == 'C': self.data = 4 self.status = 'F' else: raise KeyError return self.data def main(): return Node()" "class Node: def __init__(self, numbers): self.numbers = numbers def set_methods(self, methods): self.methods = methods def drag(self): if 'drag' in self.methods: return self.methods['drag'] raise KeyError def roam(self): if 'roam' in self.methods: return self.methods['roam'] raise KeyError def shade(self): if 'shade' in self.methods: return self.methods['shade'] raise KeyError class Automaton: def __init__(self): self.A = Node([1, 0, -1]) self.B = Node([-1, 2, -1]) self.C = Node([3, -1, -1]) self.D = Node([5, 6, 4]) self.E = Node([7, -1, -1]) self.F = Node([-1, -1, 8]) self.G = Node([-1, -1, 9]) self.A.set_methods({'roam': self.B, 'drag': self.G}) self.B.set_methods({'roam': self.C}) self.C.set_methods({'drag': self.D}) self.D.set_methods({'drag': self.G, 'roam': self.A, 'shade': self.E}) self.E.set_methods({'drag': self.F}) self.F.set_methods({'shade': self.G}) self.G.set_methods({'shade': self.E}) self.current_node = self.A def drag(self): prev_node = self.current_node try: self.current_node = self.current_node.methods['drag'] except KeyError: raise KeyError return int(prev_node.numbers[0]) def roam(self): prev_node = self.current_node try: self.current_node = self.current_node.methods['roam'] except KeyError: raise KeyError return int(prev_node.numbers[1]) def shade(self): prev_node = self.current_node try: self.current_node = self.current_node.methods['shade'] except KeyError: raise KeyError return int(prev_node.numbers[2]) def main(): return Automaton()" "class Node: def __init__(self): self.data = None self.status = 'A' def jump(self): if self.status == 'A': self.data = 1 elif self.status == 'C': self.data = 6 self.status = 'A' elif self.status == 'E': self.data = 8 self.status = 'F' else: raise KeyError return self.data def cut(self): if self.status == 'A': self.data = 0 self.status = 'B' elif self.status == 'B': self.data = 3 elif self.status == 'C': self.data = 5 elif self.status == 'F': self.data = 9 self.status = 'G' else: raise KeyError return self.data def slog(self): if self.status == 'B': self.data = 2 self.status = 'C' elif self.status == 'C': self.data = 4 self.status = 'D' elif self.status == 'D': self.data = 7 self.status = 'E' else: raise KeyError return self.data def main(): return Node()" "class Miles_FSM: def __init__(self): self.state = 'A' def slog(self): match self.state: case 'A': self.state = 'B' return 0 case 'D': self.state = 'B' return 5 case 'E': self.state = 'F' return 7 case 'G': self.state = 'H' return 10 case _: raise KeyError def throw(self): match self.state: case 'A': self.state = 'C' return 1 case 'B': self.state = 'C' return 2 case 'H': self.state = 'B' return 11 case 'D': self.state = 'F' return 6 case _: raise KeyError def coast(self): match self.state: case 'C': self.state = 'D' return 3 case 'D': self.state = 'E' return 4 case 'E': return 8 case 'F': self.state = 'G' return 9 case _: raise KeyError def main(): obj = Miles_FSM() return obj" "class main: def __init__(self): self.condition = 'A' def add(self): if self.condition == 'A': self.condition = 'B' return 0 elif self.condition == 'B': self.condition = 'B' return 2 elif self.condition == 'F': self.condition = 'B' return 10 elif self.condition == 'D': self.condition = 'H' return 6 else: raise KeyError def type(self): if self.condition == 'B': self.condition = 'C' return 1 elif self.condition == 'D': self.condition = 'E' return 4 elif self.condition == 'E': self.condition = 'E' return 8 else: raise KeyError def fill(self): if self.condition == 'C': self.condition = 'D' return 3 elif self.condition == 'E': self.condition = 'F' return 7 elif self.condition == 'F': self.condition = 'G' return 9 elif self.condition == 'G': self.condition = 'H' return 11 elif self.condition == 'D': self.condition = 'F' return 5 else: raise KeyError" "from enum import Enum class State(Enum): A = 1 B = 2 C = 3 D = 4 E = 5 F = 6 G = 7 class main: def __init__(self): self.__state = State.A def wreck(self) -> int: match self.__state: case State.A: self.__state = State.B return 0 case State.B: self.__state = State.C return 2 case State.C: self.__state = State.A return 5 case State.D: self.__state = State.E return 6 case State.E: self.__state = State.F return 7 case State.F: self.__state = State.G return 8 raise KeyError def pull(self) -> int: match self.__state: case State.C: self.__state = State.D return 4 case State.B: self.__state = State.F return 3 case State.A: self.__state = State.G return 1 case State.G: self.__state = State.D return 9 raise KeyError" "class MyClass: state = 'A' def __init__(self): self.state = 'A' def file(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': raise KeyError elif self.state == 'C': raise KeyError elif self.state == 'D': self.state = 'E' return 3 elif self.state == 'E': raise KeyError elif self.state == 'F': self.state = 'G' return 8 elif self.state == 'G': raise KeyError elif self.state == 'H': raise KeyError def cue(self): if self.state == 'A': raise KeyError elif self.state == 'B': self.state = 'C' return 1 elif self.state == 'C': self.state = 'D' return 2 elif self.state == 'D': self.state = 'F' return 4 elif self.state == 'E': self.state = 'G' return 7 elif self.state == 'F': raise KeyError elif self.state == 'G': self.state = 'H' return 10 elif self.state == 'H': self.state = 'D' return 11 def join(self): if self.state == 'A': raise KeyError elif self.state == 'B': raise KeyError elif self.state == 'C': raise KeyError elif self.state == 'D': self.state = 'B' return 5 elif self.state == 'E': self.state = 'F' return 6 elif self.state == 'F': self.state = 'C' return 9 elif self.state == 'G': raise KeyError elif self.state == 'H': raise KeyError def main(): return MyClass()" "class Mili: def __init__(self): self.condition = 'A' def paint(self): if self.condition in ['A', 'F', 'D']: if self.condition in ['A', 'F']: if self.condition == 'A': self.condition = 'B' return 0 else: self.condition = 'C' return 7 else: self.condition = 'E' return 3 else: raise KeyError def chain(self): if self.condition in ['B', 'D', 'F', 'G']: if self.condition in ['B', 'D']: if self.condition == 'B': self.condition = 'C' return 1 else: self.condition = 'A' return 4 elif self.condition == 'F': self.condition = 'B' return 8 else: self.condition = 'E' return 9 else: raise KeyError def fork(self): if self.condition in ['C', 'E', 'F']: if self.condition in ['C', 'E']: if self.condition == 'C': self.condition = 'D' return 2 else: self.condition = 'F' return 5 else: self.condition = 'G' return 6 else: raise KeyError def main(): return Mili()" "class Mili: def __init__(self): self.condition = 'A' def walk(self): if self.condition in ['A', 'B', 'C', 'E', 'F']: if self.condition in ['A', 'B', 'C']: if self.condition in ['A', 'B']: if self.condition == 'A': self.condition = 'B' return 0 else: self.condition = 'C' return 2 else: self.condition = 'D' return 4 elif self.condition == 'E': self.condition = 'F' return 7 else: self.condition = 'D' return 8 else: raise KeyError def wreck(self): if self.condition in ['A', 'B', 'C', 'D']: if self.condition in ['A', 'B']: if self.condition == 'A': self.condition = 'C' return 1 else: self.condition = 'E' return 3 elif self.condition == 'C': self.condition = 'F' return 5 else: self.condition = 'E' return 6 else: raise KeyError def main(): return Mili()" "class main: def __init__(self): self.state: main.MileMachineState = main.AState(self) def erase(self) -> int: return self.state.erase() def log(self) -> int: return self.state.log() def wreck(self) -> int: return self.state.wreck() class MileMachineState: def __init__(self, root): self.root: main = root def erase(self) -> int: raise KeyError def log(self) -> int: raise KeyError def wreck(self) -> int: raise KeyError class AState(MileMachineState): def erase(self): self.root.state = main.BState(self.root) return 0 class BState(MileMachineState): def log(self): self.root.state = main.CState(self.root) return 1 class CState(MileMachineState): def log(self): self.root.state = main.CState(self.root) return 3 def wreck(self): self.root.state = main.DState(self.root) return 2 def erase(self): self.root.state = main.EState(self.root) return 4 class DState(MileMachineState): def erase(self): self.root.state = main.EState(self.root) return 5 def log(self): self.root.state = main.AState(self.root) return 6 class EState(MileMachineState): def erase(self): self.root.state = main.FState(self.root) return 7 def log(self): self.root.state = main.EState(self.root) return 8 class FState(MileMachineState): pass" "import re class main: now_letter = 'A' slov_skip = {'A': '1A', 'B': '2C', 'D': '7F', 'E': '8F', 'F': '9G'} slov_amble = {'A': '0B', 'C': '3D', 'D': '5E'} slov_stay = {'C': '4G', 'D': '6D'} def skip(self): temp_skip = self.now_letter num = '' letter = '' if self.slov_skip.get(temp_skip, 'KeyError')[1] != 'e': let = re.findall('\\D', self.slov_skip.get(temp_skip, 'KeyError')) for e in let: letter += str(e) self.now_letter = letter number = re.findall('\\d', self.slov_skip.get(temp_skip)) for e in number: num += str(e) return int(num) else: raise KeyError def amble(self): temp_amble = self.now_letter num = '' letter = '' if self.slov_amble.get(temp_amble, 'KeyError')[1] != 'e': let = re.findall('\\D', self.slov_amble.get(temp_amble, 'KeyError')) for e in let: letter += str(e) self.now_letter = letter number = re.findall('\\d', self.slov_amble.get(temp_amble)) for e in number: num += str(e) return int(num) else: raise KeyError def stay(self): temp_stay = self.now_letter num = '' letter = '' if self.slov_stay.get(temp_stay, 'KeyError')[1] != 'e': let = re.findall('\\D', self.slov_stay.get(temp_stay, 'KeyError')) for e in let: letter += str(e) self.now_letter = letter number = re.findall('\\d', self.slov_stay.get(temp_stay)) for e in number: num += str(e) return int(num) else: raise KeyError" "from abc import ABC, abstractmethod class P(ABC): @abstractmethod def spawn(self, current): pass @abstractmethod def show(self, current): pass @abstractmethod def wreck(self, current): pass class A(P): def spawn(self, current): current.current = B() return 0 def show(self, current): current.current = F() return 2 def wreck(self, current): current.current = G() return 1 class B(P): def spawn(self, current): current.current = H() return 4 def wreck(self, current): raise KeyError() def show(self, current): current.current = C() return 3 class C(P): def spawn(self, current): current.current = D() return 5 def show(self, current): raise KeyError() def wreck(self, current): raise KeyError() class D(P): def spawn(self, current): current.current = A() return 7 def show(self, current): raise KeyError() def wreck(self, current): current.current = E() return 6 class E(P): def spawn(self, current): raise KeyError() def show(self, current): current.current = F() return 8 def wreck(self, current): raise KeyError() class F(P): def spawn(self, current): raise KeyError() def show(self, current): raise KeyError() def wreck(self, current): current.current = G() return 9 class G(P): def spawn(self, current): raise KeyError() def show(self, current): raise KeyError() def wreck(self, current): current.current = H() return 10 class H(P): def spawn(self, current): raise KeyError def show(self, current): raise KeyError def wreck(self, current): current.current = H() return 11 class Finite_Automata: def __init__(self): self.current = A() def spawn(self): return self.current.spawn(self) def show(self): return self.current.show(self) def wreck(self): return self.current.wreck(self) def main(): return Finite_Automata()" "from enum import Enum class State(Enum): A = 1 B = 2 C = 3 D = 4 E = 5 F = 6 G = 7 H = 8 class main: def __init__(self): self.__state = State.A def slur(self) -> int: match self.__state: case State.A: self.__state = State.B return 0 case State.C: self.__state = State.H return 3 case State.D: self.__state = State.A return 5 case State.F: self.__state = State.A return 9 raise KeyError def turn(self) -> int: match self.__state: case State.B: self.__state = State.C return 1 case State.C: self.__state = State.D return 2 case State.E: self.__state = State.F return 7 case State.F: self.__state = State.G return 8 case State.D: self.__state = State.F return 6 raise KeyError def clear(self) -> int: match self.__state: case State.D: self.__state = State.E return 4 case State.G: self.__state = State.H return 10 case State.H: return 11 raise KeyError" "class main: def __init__(self): self.condition = 'A' def crash(self): if self.condition == 'A': self.condition = 'B' return 0 elif self.condition == 'B': self.condition = 'C' return 3 elif self.condition == 'D': self.condition = 'E' return 5 elif self.condition == 'E': self.condition = 'H' return 7 else: raise KeyError def march(self): if self.condition == 'C': self.condition = 'D' return 4 elif self.condition == 'E': self.condition = 'F' return 6 elif self.condition == 'F': self.condition = 'G' return 9 elif self.condition == 'G': self.condition = 'H' return 10 elif self.condition == 'A': self.condition = 'F' return 2 else: raise KeyError def amass(self): if self.condition == 'A': self.condition = 'E' return 1 elif self.condition == 'E': self.condition = 'G' return 8 elif self.condition == 'H': self.condition = 'A' return 11 else: raise KeyError" "class main: def __init__(self): self.condition = 'A' def drag(self): if self.condition == 'A': self.condition = 'A' return 1 elif self.condition == 'C': self.condition = 'D' return 3 elif self.condition == 'D': self.condition = 'E' return 5 elif self.condition == 'E': self.condition = 'A' return 7 elif self.condition == 'F': self.condition = 'G' return 8 elif self.condition == 'G': self.condition = 'C' return 11 else: raise KeyError def mix(self): if self.condition == 'A': self.condition = 'B' return 0 elif self.condition == 'B': self.condition = 'C' return 2 elif self.condition == 'C': self.condition = 'A' return 4 elif self.condition == 'E': self.condition = 'F' return 6 elif self.condition == 'F': self.condition = 'B' return 9 elif self.condition == 'G': self.condition = 'H' return 10 else: raise KeyError o = main()" "class main: def __init__(self) -> None: self.level = 0 def hike(self): if self.level == 0: self.level = 1 return 0 elif self.level == 2: self.level = 5 return 4 elif self.level == 3: self.level = 5 return 7 else: raise KeyError() def group(self): if self.level == 1: self.level = 2 return 2 elif self.level == 3: self.level = 4 return 5 elif self.level == 4: self.level = 5 return 8 elif self.level == 5: self.level = 6 return 9 elif self.level == 6: self.level = 2 return 11 elif self.level == 0: self.level = 5 return 1 else: raise KeyError() def tag(self): if self.level == 6: self.level = 7 return 10 else: raise KeyError() def tail(self): if self.level == 3: self.level = 0 return 6 elif self.level == 2: self.level = 3 return 3 else: raise KeyError()" "class main: point = 'A' shade1 = {'A': '0B', 'B': '1C', 'C': '4A'} skew1 = {'C': '3D', 'D': '6B', 'B': '2F', 'G': '9A'} walk1 = {'D': '5E', 'E': '7F', 'F': '8G'} def shade(self): tmp_blame = self.point if self.shade1.get(tmp_blame, 'KeyError')[1] != 'e': self.point = self.shade1.get(tmp_blame, 'KeyError')[1] return int(self.shade1.get(tmp_blame)[0]) else: raise KeyError def skew(self): tmp_view = self.point if self.skew1.get(tmp_view, 'KeyError')[1] != 'e': self.point = self.skew1.get(tmp_view, 'KeyError')[1] return int(self.skew1.get(tmp_view)[0]) else: raise KeyError def walk(self): tmp_drag = self.point if self.walk1.get(tmp_drag, 'KeyError')[1] != 'e': self.point = self.walk1.get(tmp_drag, 'KeyError')[1] return int(self.walk1.get(tmp_drag)[0]) else: raise KeyError" "class main: def __init__(self): self.__state = 'A' def init(self): if self.__state == 'A': self.__state = 'B' return 0 if self.__state == 'B': self.__state = 'C' return 2 if self.__state == 'C': return 5 if self.__state == 'D': self.__state = 'E' return 6 if self.__state == 'E': self.__state = 'F' return 7 if self.__state == 'F': self.__state = 'A' return 10 raise KeyError def edit(self): if self.__state == 'C': self.__state = 'D' return 4 if self.__state == 'A': self.__state = 'D' return 1 if self.__state == 'B': self.__state = 'H' return 3 if self.__state == 'E': return 8 if self.__state == 'F': self.__state = 'G' return 9 if self.__state == 'G': self.__state = 'H' return 11 raise KeyError" "def main(): class Automath: STATE = 'A' def place(self): if self.STATE == 'A': self.STATE = 'B' return 0 elif self.STATE == 'B': self.STATE = 'C' return 2 elif self.STATE == 'H': self.STATE = 'C' return 11 elif self.STATE == 'D': self.STATE = 'G' return 6 else: raise KeyError def trim(self): if self.STATE == 'B': self.STATE = 'B' return 3 elif self.STATE == 'C': self.STATE = 'D' return 4 elif self.STATE == 'D': self.STATE = 'D' return 7 elif self.STATE == 'E': self.STATE = 'F' return 8 elif self.STATE == 'G': self.STATE = 'H' return 10 else: raise KeyError def hop(self): if self.STATE == 'A': self.STATE = 'C' return 1 elif self.STATE == 'D': self.STATE = 'E' return 5 elif self.STATE == 'F': self.STATE = 'G' return 9 else: raise KeyError a = Automath() return a" "class main(object): def __init__(self): self.state = 0 self.list = {0: 0, 1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8} def smash(self): if self.state == 0: self.state = 0 return self.list.get(2) elif self.state == 3: self.state = 4 return self.list.get(6) elif self.state == 4: self.state = 5 return self.list.get(7) else: return self.list[9] def tag(self): if self.state == 0: self.state = 1 return self.list.get(0) elif self.state == 1: self.state = 2 return self.list.get(3) elif self.state == 4: self.state = 2 return self.list.get(8) else: return self.list[9] def dash(self): if self.state == 0: self.state = 2 return self.list.get(1) elif self.state == 2: self.state = 3 return self.list.get(5) elif self.state == 1: self.state = 4 return self.list.get(4) else: return self.list[9]" "class Mili(object): letter = 'A' def patch(self): match self.letter: case 'A': self.letter = 'B' return 0 case 'B': self.letter = 'C' return 2 case 'C': self.letter = 'A' return 4 case 'D': self.letter = 'E' return 5 case 'F': self.letter = 'D' return 8 case 'G': self.letter = 'H' return 9 case 'H': self.letter = 'A' return 11 case _: raise KeyError def carve(self): match self.letter: case 'A': self.letter = 'F' return 1 case 'C': self.letter = 'D' return 3 case 'E': self.letter = 'F' return 6 case 'F': self.letter = 'G' return 7 case 'G': self.letter = 'E' return 10 case _: raise KeyError def main(): test = Mili() return test" "class main: def __init__(self) -> None: self.level = 0 def mix(self): if self.level == 0: self.level = 1 return 0 elif self.level == 3: self.level = 3 return 7 elif self.level == 5: self.level = 6 return 9 elif self.level == 6: self.level = 7 return 10 else: raise KeyError() def step(self): if self.level == 0: self.level = 2 return 1 elif self.level == 3: self.level = 6 return 6 else: raise KeyError() def mass(self): if self.level == 1: self.level = 2 return 2 elif self.level == 3: self.level = 0 return 5 elif self.level == 4: self.level = 5 return 8 elif self.level == 6: self.level = 1 return 11 else: raise KeyError() def tail(self): if self.level == 2: self.level = 3 return 3 elif self.level == 3: self.level = 4 return 4 else: raise KeyError()" "class main: def __init__(self) -> None: self.level = 0 def load(self): if self.level == 0: self.level = 1 return 0 elif self.level == 1: self.level = 2 return 2 elif self.level == 2: self.level = 3 return 4 elif self.level == 3: self.level = 4 return 6 elif self.level == 5: self.level = 6 return 8 else: raise KeyError() def stare(self): if self.level == 1: self.level = 1 return 3 elif self.level == 2: self.level = 4 return 5 elif self.level == 4: self.level = 5 return 7 elif self.level == 5: self.level = 2 return 9 elif self.level == 0: self.level = 6 return 1 else: raise KeyError()" "A = [[1, 0], [3, 1]] B = [[2, 2], [1, 'KeyError']] C = [[6, 4], [3, 3]] D = [[4, 5], [3, 'KeyError']] E = [[5, 6], [4, 'KeyError']] F = [[6, 7], [2, 8]] G = [[1, 9], [6, 'KeyError']] sett = [A, B, C, D, E, F, G] class Mili: def __init__(self): self.state = A def amass(self): buf = self.state if buf[0][1] == 'KeyError': raise KeyError('KeyError') else: self.state = sett[self.state[0][0]] return buf[0][1] def pull(self): buf = self.state if buf[1][1] == 'KeyError': raise KeyError('KeyError') else: self.state = sett[self.state[1][0]] return buf[1][1] def main(): return Mili()" "class main: def __init__(self) -> None: self.level = 0 def fill(self): if self.level == 0: self.level = 1 return 0 elif self.level == 2: self.level = 3 return 2 elif self.level == 3: self.level = 5 return 5 elif self.level == 4: self.level = 5 return 6 elif self.level == 5: self.level = 6 return 8 else: raise KeyError() def sort(self): if self.level == 1: self.level = 2 return 1 elif self.level == 2: self.level = 0 return 3 elif self.level == 3: self.level = 4 return 4 elif self.level == 5: self.level = 1 return 9 elif self.level == 4: self.level = 1 return 7 else: raise KeyError()" "class main: def __init__(self): self.STATE = 'A' def run(self): if self.STATE == 'B': self.STATE = 'C' return 1 if self.STATE == 'D': self.STATE = 'A' return 4 raise KeyError def stay(self): if self.STATE == 'A': self.STATE = 'B' return 0 if self.STATE == 'C': self.STATE = 'D' return 2 if self.STATE == 'D': self.STATE = 'F' return 6 if self.STATE == 'E': self.STATE = 'A' return 8 raise KeyError def link(self): if self.STATE == 'D': self.STATE = 'D' return 5 raise KeyError def tread(self): if self.STATE == 'D': self.STATE = 'E' return 3 if self.STATE == 'E': self.STATE = 'F' return 7 raise KeyError" "class main: def __init__(self): self.state = 'A' def group(self): group_dict = {'A': ['B', 0], 'B': ['C', 2], 'D': ['E', 5], 'F': ['H', 9], 'G': ['H', 11]} if self.state in group_dict: return_value = group_dict[self.state][1] self.state = group_dict[self.state][0] return return_value raise KeyError def put(self): put_dict = {'A': ['D', 1], 'C': ['H', 4], 'E': ['F', 6], 'F': ['G', 8]} if self.state in put_dict: return_value = put_dict[self.state][1] self.state = put_dict[self.state][0] return return_value raise KeyError def scrub(self): scrub_dict = {'C': ['D', 3], 'F': ['D', 10], 'E': ['A', 7]} if self.state in scrub_dict: return_value = scrub_dict[self.state][1] self.state = scrub_dict[self.state][0] return return_value raise KeyError" "import re class main: now_letter = 'A' slov_glare = {'A': '2G', 'B': '3C', 'C': '4D'} slov_fade = {'A': '0B', 'E': '8B', 'G': '10H'} slov_fork = {'A': '1D', 'C': '5E', 'E': '7F', 'F': '9G'} slov_unite = {'D': '6E', 'G': '11D'} def glare(self): temp_glare = self.now_letter num = '' letter = '' if self.slov_glare.get(temp_glare, 'KeyError')[1] != 'e': let = re.findall('\\D', self.slov_glare.get(temp_glare, 'KeyError')) for e in let: letter += str(e) self.now_letter = letter number = re.findall('\\d', self.slov_glare.get(temp_glare)) for e in number: num += str(e) return int(num) else: raise KeyError def fade(self): temp_fade = self.now_letter num = '' letter = '' if self.slov_fade.get(temp_fade, 'KeyError')[1] != 'e': let = re.findall('\\D', self.slov_fade.get(temp_fade, 'KeyError')) for e in let: letter += str(e) self.now_letter = letter number = re.findall('\\d', self.slov_fade.get(temp_fade)) for e in number: num += str(e) return int(num) else: raise KeyError def fork(self): temp_fork = self.now_letter num = '' letter = '' if self.slov_fork.get(temp_fork, 'KeyError')[1] != 'e': let = re.findall('\\D', self.slov_fork.get(temp_fork, 'KeyError')) for e in let: letter += str(e) self.now_letter = letter number = re.findall('\\d', self.slov_fork.get(temp_fork)) for e in number: num += str(e) return int(num) else: raise KeyError def unite(self): temp_unite = self.now_letter num = '' letter = '' if self.slov_unite.get(temp_unite, 'KeyError')[1] != 'e': let = re.findall('\\D', self.slov_unite.get(temp_unite, 'KeyError')) for e in let: letter += str(e) self.now_letter = letter number = re.findall('\\d', self.slov_unite.get(temp_unite)) for e in number: num += str(e) return int(num) else: raise KeyError" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def bolt(self): return self.update({State.A: [State.A, 1], State.B: [State.D, 4], State.E: [State.F, 7], State.F: [State.C, 9]}) def walk(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 3], State.C: [State.D, 5], State.F: [State.G, 8]}) def base(self): return self.update({State.A: [State.D, 2], State.D: [State.E, 6]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "def prime(fn): def wrapper(*args, **kwargs): v = fn(*args, **kwargs) v.send(None) return v return wrapper class FSM: def __init__(self): self.a = self._create_a() self.b = self._create_b() self.c = self._create_c() self.d = self._create_d() self.e = self._create_e() self.f = self._create_f() self.g = self._create_g() self.h = self._create_h() self.current_state = self.a def send(self, char): response = self.current_state.send(char) if response is None: response = self.current_state.send(char) return response @prime def _create_a(self): while True: char = (yield) if char == 'p': self.current_state = self.g yield 1 elif char == 'a': self.current_state = self.f yield 2 elif char == 'm': self.current_state = self.b yield 0 else: yield KeyError @prime def _create_b(self): while True: char = (yield) if char == 'm': self.current_state = self.c yield 3 else: yield KeyError @prime def _create_c(self): while True: char = (yield) if char == 'a': self.current_state = self.d yield 4 else: yield KeyError @prime def _create_d(self): while True: char = (yield) if char == 'a': self.current_state = self.e yield 5 else: yield KeyError @prime def _create_e(self): while True: char = (yield) if char == 'p': self.current_state = self.c yield 7 elif char == 'a': self.current_state = self.f yield 6 else: yield KeyError @prime def _create_f(self): while True: char = (yield) if char == 'a': self.current_state = self.f yield 9 elif char == 'p': self.current_state = self.g yield 8 else: yield KeyError @prime def _create_g(self): while True: char = (yield) if char == 'p': self.current_state = self.h yield 10 else: yield KeyError @prime def _create_h(self): while True: char = (yield) if char == 'm': self.current_state = self.b yield 11 else: yield KeyError def apply(self): response = self.send('a') if response == KeyError: raise KeyError else: return response def pan(self): response = self.send('p') if response == KeyError: raise KeyError else: return response def march(self): response = self.send('m') if response == KeyError: raise KeyError else: return response def main(): obj = FSM() return obj" "import re class main: now_letter = 'A' slov_merge = {'A': '1A', 'C': '4C', 'D': '5E', 'E': '7F'} slov_smash = {'A': '0B', 'B': '2C', 'C': '3D', 'D': '6F', 'E': '8E'} def merge(self): temp_brake = self.now_letter num = '' letter = '' if self.slov_merge.get(temp_brake, 'KeyError')[1] != 'e': let = re.findall('\\D', self.slov_merge.get(temp_brake, 'KeyError')) for e in let: letter += str(e) self.now_letter = letter number = re.findall('\\d', self.slov_merge.get(temp_brake)) for e in number: num += str(e) return int(num) else: raise KeyError def smash(self): temp_melt = self.now_letter num = '' letter = '' if self.slov_smash.get(temp_melt, 'KeyError')[1] != 'e': let = re.findall('\\D', self.slov_smash.get(temp_melt, 'KeyError')) for e in let: letter += str(e) self.now_letter = letter number = re.findall('\\d', self.slov_smash.get(temp_melt)) for e in number: num += str(e) return int(num) else: raise KeyError" "class main: def __init__(self): self.condition = 'A' def etch(self): if self.condition == 'A': self.condition = 'A' return 1 elif self.condition == 'D': self.condition = 'E' return 4 elif self.condition == 'E': self.condition = 'F' return 6 else: raise KeyError def crack(self): if self.condition == 'A': self.condition = 'B' return 0 elif self.condition == 'B': self.condition = 'C' return 2 elif self.condition == 'C': self.condition = 'D' return 3 elif self.condition == 'D': self.condition = 'B' return 5 elif self.condition == 'E': self.condition = 'A' return 7 elif self.condition == 'F': self.condition = 'G' return 8 elif self.condition == 'G': self.condition = 'E' return 9 else: raise KeyError" "class A: state = 'A' def crack(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'F' return 2 elif self.state == 'D': self.state = 'E' return 5 elif self.state == 'F': self.state = 'G' return 7 elif self.state == 'G': self.state = 'H' return 9 else: raise KeyError def mask(self): if self.state == 'B': self.state = 'B' return 3 elif self.state == 'C': self.state = 'D' return 4 elif self.state == 'E': self.state = 'F' return 6 elif self.state == 'G': self.state = 'D' return 10 elif self.state == 'H': self.state = 'A' return 11 else: raise KeyError def throw(self): if self.state == 'B': self.state = 'C' return 1 elif self.state == 'F': self.state = 'D' return 8 else: raise KeyError def main(): return A()" "class main: def __init__(self): self.__state = 'A' def clone(self): if self.__state == 'A': self.__state = 'B' return 0 if self.__state == 'B': self.__state = 'C' return 1 if self.__state == 'C': self.__state = 'D' return 3 if self.__state == 'D': self.__state = 'E' return 4 if self.__state == 'E': self.__state = 'F' return 6 if self.__state == 'F': self.__state = 'G' return 8 raise KeyError def sort(self): if self.__state == 'B': self.__state = 'F' return 2 if self.__state == 'D': return 5 if self.__state == 'E': self.__state = 'B' return 7 if self.__state == 'F': self.__state = 'C' return 9 raise KeyError" "class main: def __init__(self): self.condition = 'A' def drag(self): if self.condition == 'A': self.condition = 'B' return 0 elif self.condition == 'B': self.condition = 'D' return 3 elif self.condition == 'C': self.condition = 'G' return 5 elif self.condition == 'D': self.condition = 'E' return 6 elif self.condition == 'F': self.condition = 'F' return 10 elif self.condition == 'G': self.condition = 'H' return 11 else: raise KeyError def paint(self): if self.condition == 'B': self.condition = 'C' return 1 elif self.condition == 'C': self.condition = 'D' return 4 elif self.condition == 'E': self.condition = 'F' return 7 else: raise KeyError def reset(self): if self.condition == 'B': self.condition = 'F' return 2 elif self.condition == 'E': self.condition = 'E' return 8 elif self.condition == 'F': self.condition = 'G' return 9 else: raise KeyError" "class Graph: def __init__(self): self.state = 'A' self.graph = {('A', 'crash'): ('B', 0), ('A', 'mass'): ('E', 1), ('B', 'get'): ('F', 3), ('B', 'mass'): ('C', 2), ('B', 'crash'): ('E', 4), ('C', 'get'): ('D', 5), ('D', 'get'): ('E', 6), ('E', 'get'): ('F', 7), ('F', 'mass'): ('D', 9), ('F', 'get'): ('G', 8)} def mass(self): (self.state, ret) = self.graph[self.state, 'mass'] return ret def crash(self): (self.state, ret) = self.graph[self.state, 'crash'] return ret def get(self): (self.state, ret) = self.graph[self.state, 'get'] return ret def main(): obj = Graph() return obj" "class Mili: state = -1 def throw(self): if self.state in [-1, 10]: self.state = 0 elif self.state == 0: self.state = 3 elif self.state == 2: self.state = 4 elif self.state in [5, 8]: self.state = 7 else: raise KeyError return self.state def stay(self): if self.state == 0: self.state = 2 elif self.state in [3, 6, 7]: self.state = 9 else: raise KeyError return self.state def begin(self): if self.state in [-1, 10]: self.state = 1 elif self.state == 4: self.state = 5 elif self.state == 5: self.state = 8 elif self.state in [7, 6, 3]: self.state = 10 elif self.state == 8: self.state = 8 elif self.state in [1, 9]: self.state = 11 else: raise KeyError return self.state def start(self): if self.state == 4: self.state = 6 else: raise KeyError return self.state def main(): return Mili()" "class main: def __init__(self): self.sos = 'A' def stand(self): if self.sos == 'A': self.sos = 'B' return 0 elif self.sos == 'C': self.sos = 'A' return 3 elif self.sos == 'E': self.sos = 'A' return 7 elif self.sos == 'D': self.sos = 'E' return 4 else: raise KeyError def put(self): if self.sos == 'B': self.sos = 'C' return 1 elif self.sos == 'F': self.sos = 'B' return 8 elif self.sos == 'E': self.sos = 'F' return 5 else: raise KeyError def play(self): if self.sos == 'C': self.sos = 'D' return 2 elif self.sos == 'E': self.sos = 'C' return 6 else: raise KeyError" "class main: def __init__(self): self.state = 'A' def draw(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'C': self.state = 'E' return 4 elif self.state == 'D': self.state = 'E' return 5 elif self.state == 'G': self.state = 'A' return 10 raise KeyError def model(self): if self.state == 'B': self.state = 'C' return 1 elif self.state == 'E': self.state = 'F' return 6 elif self.state == 'F': self.state = 'G' return 7 elif self.state == 'G': self.state = 'H' return 8 raise KeyError def pan(self): if self.state == 'B': self.state = 'D' return 2 elif self.state == 'C': self.state = 'D' return 3 elif self.state == 'G': self.state = 'D' return 9 elif self.state == 'H': self.state = 'E' return 11 raise KeyError" "from enum import Enum class State(Enum): A = 1 B = 2 C = 3 D = 4 E = 5 F = 6 class main: def __init__(self): self.__state = State.A def tread(self) -> int: match self.__state: case State.A: self.__state = State.B return 0 case State.B: self.__state = State.B return 4 case State.C: self.__state = State.D return 5 case State.D: self.__state = State.E return 6 case State.E: self.__state = State.F return 7 raise KeyError def brake(self) -> int: match self.__state: case State.B: self.__state = State.C return 2 case State.A: self.__state = State.D return 1 raise KeyError def code(self) -> int: match self.__state: case State.E: self.__state = State.C return 8 case State.B: self.__state = State.F return 3 raise KeyError" "class Milli: def __init__(self, state): self.state = state def swap(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'C': self.state = 'D' return 4 elif self.state == 'D': self.state = 'E' return 6 elif self.state == 'H': self.state = 'B' return 11 else: raise KeyError def apply(self): if self.state == 'A': self.state = 'G' return 2 elif self.state == 'B': self.state = 'C' return 3 elif self.state == 'F': self.state = 'G' return 9 elif self.state == 'G': self.state = 'H' return 10 else: raise KeyError def slur(self): if self.state == 'E': self.state = 'F' return 8 elif self.state == 'D': self.state = 'H' return 7 elif self.state == 'C': self.state = 'H' return 5 elif self.state == 'A': self.state = 'H' return 1 else: raise KeyError def main(): return Milli('A')" "class main: def __init__(self) -> None: self.level = 0 def slur(self): if self.level == 0: self.level = 1 return 0 elif self.level == 1: self.level = 2 return 2 elif self.level == 2: self.level = 3 return 4 elif self.level == 3: self.level = 4 return 5 elif self.level == 4: self.level = 5 return 8 else: raise KeyError() def smash(self): if self.level == 4: self.level = 0 return 9 elif self.level == 3: self.level = 3 return 6 elif self.level == 1: self.level = 4 return 3 elif self.level == 6: self.level = 7 return 11 else: raise KeyError() def flip(self): if self.level == 0: self.level = 7 return 1 elif self.level == 3: self.level = 6 return 7 elif self.level == 5: self.level = 6 return 10 else: raise KeyError()" "class main: def __init__(self): self.state = 'A' self.graph = {('A', 'build'): ('B', 0), ('A', 'get'): ('D', 1), ('B', 'build'): ('C', 2), ('C', 'get'): ('D', 3), ('C', 'cull'): ('F', 4), ('D', 'get'): ('E', 5), ('D', 'build'): ('D', 6), ('D', 'cull'): ('F', 7), ('E', 'build'): ('F', 8), ('F', 'cull'): ('G', 9)} def build(self): (self.state, res) = self.graph[self.state, 'build'] return res def get(self): (self.state, res) = self.graph[self.state, 'get'] return res def cull(self): (self.state, res) = self.graph[self.state, 'cull'] return res" "class main: def __init__(self): self._state = 'A' self._graph = {('A', 'crush'): ('B', 0), ('B', 'skew'): ('C', 1), ('C', 'crush'): ('D', 2), ('C', 'skew'): ('C', 3), ('D', 'melt'): ('E', 4), ('E', 'crush'): ('F', 5), ('E', 'skew'): ('B', 6), ('E', 'melt'): ('C', 7), ('F', 'skew'): ('F', 8)} def crush(self): (self._state, ret) = self._graph[self._state, 'crush'] return ret def skew(self): (self._state, ret) = self._graph[self._state, 'skew'] return ret def melt(self): (self._state, ret) = self._graph[self._state, 'melt'] return ret" "class Milli: def __init__(self, state): self.state = state def stash(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'D' return 4 elif self.state == 'E': self.state = 'F' return 8 elif self.state == 'D': self.state = 'H' return 7 elif self.state == 'G': self.state = 'H' return 10 else: raise KeyError def group(self): if self.state == 'B': self.state = 'C' return 1 elif self.state == 'D': self.state = 'E' return 6 else: raise KeyError def patch(self): if self.state == 'F': self.state = 'G' return 9 elif self.state == 'B': self.state = 'H' return 3 else: raise KeyError def jog(self): if self.state == 'C': self.state = 'D' return 5 elif self.state == 'B': self.state = 'F' return 2 elif self.state == 'H': self.state = 'F' return 11 else: raise KeyError def main(): return Milli('A')" "class main: def __init__(self): self.loc = 'A' self.tree = {('A', 'leer'): ('B', 0), ('B', 'widen'): ('C', 2), ('C', 'leer'): ('D', 3), ('D', 'widen'): ('E', 4), ('E', 'leer'): ('F', 6), ('F', 'leer'): ('G', 8), ('G', 'widen'): ('H', 10), ('H', 'widen'): ('C', 11), ('A', 'widen'): ('H', 1), ('D', 'leer'): ('A', 5), ('E', 'widen'): ('E', 7), ('F', 'widen'): ('F', 9)} def leer(self): (self.loc, ret) = self.tree[self.loc, 'leer'] return ret def widen(self): (self.loc, ret) = self.tree[self.loc, 'widen'] return ret" "class main: def __init__(self): self.condition = 'A' def snap(self): if self.condition == 'A': self.condition = 'B' return 0 elif self.condition == 'B': self.condition = 'F' return 5 elif self.condition == 'D': self.condition = 'E' return 7 else: raise KeyError def pose(self): if self.condition == 'B': self.condition = 'C' return 4 elif self.condition == 'C': self.condition = 'D' return 6 elif self.condition == 'A': self.condition = 'E' return 3 elif self.condition == 'E': self.condition = 'F' return 8 elif self.condition == 'F': self.condition = 'G' return 9 else: raise KeyError def slog(self): if self.condition == 'A': self.condition = 'C' return 2 else: raise KeyError def march(self): if self.condition == 'A': self.condition = 'F' return 1 else: raise KeyError" "class FSM: states = dict(A=[[0, 'B'], [1, 'F']], B=[[3, 'B'], [2, 'C']], C=[[4, 'D'], [4, '-']], D=[[9, '-'], [5, 'E']], E=[[6, '-'], [6, 'F']], F=[[7, 'G'], [8, 'B']], G=[[9, 'A'], [9, '-']]) def __init__(self): self.state = 'A' def carve(self): if self.states[self.state][1][1] == '-': raise KeyError else: a = self.states[self.state][1][0] self.state = self.states[self.state][1][1] return a def smash(self): if self.states[self.state][0][1] == '-': raise KeyError else: a = self.states[self.state][0][0] self.state = self.states[self.state][0][1] return a def main(): obj = FSM() return obj" "class Miles_FSM: def __init__(self): self.state = 'A' def scan(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'C': self.state = 'G' return 4 elif self.state == 'D': self.state = 'G' return 7 elif self.state == 'G': self.state = 'H' return 11 else: raise KeyError def punch(self): if self.state == 'A': self.state = 'D' return 1 elif self.state == 'C': self.state = 'C' return 5 elif self.state == 'E': self.state = 'H' return 9 else: raise KeyError def wreck(self): if self.state == 'B': self.state = 'C' return 2 elif self.state == 'C': self.state = 'D' return 3 elif self.state == 'D': self.state = 'E' return 6 elif self.state == 'E': self.state = 'F' return 8 elif self.state == 'F': self.state = 'G' return 10 else: raise KeyError def main(): obj = Miles_FSM() return obj" "class main: def __init__(self): self.condition = 'A' def erase(self): if self.condition == 'A': self.condition = 'B' return 0 elif self.condition == 'C': self.condition = 'D' return 2 elif self.condition == 'D': self.condition = 'E' return 3 elif self.condition == 'E': self.condition = 'C' return 6 elif self.condition == 'F': self.condition = 'G' return 8 else: raise KeyError def show(self): if self.condition == 'B': self.condition = 'C' return 1 elif self.condition == 'D': self.condition = 'A' return 4 elif self.condition == 'G': self.condition = 'E' return 9 elif self.condition == 'E': self.condition = 'F' return 5 else: raise KeyError def look(self): if self.condition == 'E': self.condition = 'B' return 7 else: raise KeyError" "class main: def __init__(self): self.condition = 'A' def add(self): if self.condition == 'A': self.condition = 'B' return 0 elif self.condition == 'B': self.condition = 'C' return 1 elif self.condition == 'C': self.condition = 'D' return 2 elif self.condition == 'D': self.condition = 'F' return 5 elif self.condition == 'G': self.condition = 'G' return 10 else: raise KeyError def stall(self): if self.condition == 'D': self.condition = 'B' return 4 elif self.condition == 'E': self.condition = 'B' return 7 elif self.condition == 'F': self.condition = 'G' return 8 elif self.condition == 'G': self.condition = 'A' return 11 else: raise KeyError def crush(self): if self.condition == 'D': self.condition = 'E' return 3 elif self.condition == 'E': self.condition = 'F' return 6 elif self.condition == 'G': self.condition = 'H' return 9 else: raise KeyError" "class main: def __init__(self): self.condition = 'A' def chat(self): if self.condition == 'A': self.condition = 'B' return 0 elif self.condition == 'B': self.condition = 'C' return 2 elif self.condition == 'D': self.condition = 'E' return 6 elif self.condition == 'E': self.condition = 'F' return 7 elif self.condition == 'C': self.condition = 'G' return 5 elif self.condition == 'G': self.condition = 'A' return 10 else: raise KeyError def add(self): if self.condition == 'A': self.condition = 'D' return 1 elif self.condition == 'C': self.condition = 'D' return 4 elif self.condition == 'B': self.condition = 'D' return 3 elif self.condition == 'F': self.condition = 'G' return 8 elif self.condition == 'G': self.condition = 'H' return 9 elif self.condition == 'H': self.condition = 'D' return 11 else: raise KeyError" "class State: current_state = 10 def update(obj={}): fun_state = State.current_state State.current_state = obj[State.current_state] return obj[fun_state] class main: def close(self): result = State.update(obj={10: 0, 0: 2, 1: 4, 5: 7, 3: 5, 9: 5, 6: 8, 2: 8, 7: 4, 4: 0}) return result def run(self): result = State.update(obj={0: 1, 1: 3, 5: 6, 6: 9, 2: 9, 7: 3}) return result" "class main: def __init__(self): self.state = 'A' def link(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'B' return 4 elif self.state == 'E': self.state = 'F' return 8 else: raise KeyError() def code(self): if self.state == 'A': self.state = 'D' return 1 elif self.state == 'B': self.state = 'C' return 2 elif self.state == 'C': self.state = 'F' return 6 elif self.state == 'D': self.state = 'E' return 7 else: raise KeyError() def stash(self): if self.state == 'B': self.state = 'F' return 3 elif self.state == 'C': self.state = 'D' return 5 else: raise KeyError() def main(self): return main()" "class main(object): def __init__(self): self.status = 'A' def code(self): match self.status: case 'A': self.status = 'B' return 0 case 'B': self.status = 'E' return 3 case 'C': self.status = 'D' return 5 case 'G': self.status = 'C' return 9 case _: raise KeyError def scale(self): match self.status: case 'A': self.status = 'C' return 1 case 'B': self.status = 'D' return 4 case 'F': self.status = 'G' return 8 case _: raise KeyError def sweep(self): match self.status: case 'B': self.status = 'C' return 2 case 'D': self.status = 'E' return 6 case 'E': self.status = 'F' return 7 case _: raise KeyError" "class main: def __init__(self): self.a = True self.b = False self.c = False self.d = False self.e = False self.f = False def empty(self): self.a = False self.b = False self.c = False self.d = False self.e = False self.f = False return 0 def type(self): if self.a and (not self.b): self.empty() self.b = True return 0 elif self.b and (not self.c): return 3 elif self.d and (not self.e): self.empty() self.e = True return 5 elif self.e and (not self.f): self.empty() self.f = True return 6 raise KeyError('KeyError') return 'KeyError' def run(self): if self.b and (not self.c): self.empty() self.c = True return 2 elif self.c and (not self.d): self.empty() self.d = True return 4 elif self.e and (not self.a): self.empty() self.a = True return 8 elif self.a and (not self.f): self.empty() self.f = True return 1 raise KeyError('KeyError') return 'KeyError' def carve(self): if self.e and (not self.c): self.empty() self.d = False self.c = True return 7 raise KeyError('KeyError') return 'KeyError'" "class main(object): def __init__(self): self.status = 'A' def add(self): match self.status: case 'A': self.status = 'B' return 0 case 'B': self.status = 'B' return 3 case 'C': self.status = 'D' return 4 case 'D': self.status = 'A' return 6 case 'E': self.status = 'F' return 7 case _: raise KeyError def pose(self): match self.status: case 'A': self.status = 'F' return 1 case 'B': self.status = 'C' return 2 case 'D': self.status = 'E' return 5 case 'E': self.status = 'F' return 7 case 'F': self.status = 'F' return 8 case _: raise KeyError" "class main: def __init__(self): self.condition = 'A' def file(self): if self.condition == 'A': self.condition = 'B' return 0 elif self.condition == 'B': self.condition = 'C' return 1 elif self.condition == 'C': self.condition = 'A' return 4 elif self.condition == 'E': self.condition = 'C' return 7 elif self.condition == 'F': self.condition = 'F' return 8 else: raise KeyError def dash(self): if self.condition == 'B': self.condition = 'D' return 2 elif self.condition == 'C': self.condition = 'D' return 3 elif self.condition == 'D': self.condition = 'E' return 5 elif self.condition == 'E': self.condition = 'F' return 6 else: raise KeyError" "class main: stat = 'A' def sweep(self): match self.stat: case 'A': self.stat = 'B' return 0 case 'F': self.stat = 'G' return 5 case _: raise KeyError def start(self): match self.stat: case 'B': self.stat = 'C' return 1 case 'F': self.stat = 'D' return 9 case _: raise KeyError def exit(self): match self.stat: case 'C': self.stat = 'D' return 2 case 'D': self.stat = 'E' return 3 case 'F': self.stat = 'B' return 8 case _: raise KeyError def throw(self): match self.stat: case 'F': self.stat = 'C' return 7 case 'G': self.stat = 'H' return 10 case 'H': return 11 case _: raise KeyError def align(self): match self.stat: case 'E': self.stat = 'F' return 4 case 'F': self.stat = 'A' return 6 case _: raise KeyError" "class main: def __init__(self): self.state = 'A' def peek(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 1 elif self.state == 'C': self.state = 'D' return 3 elif self.state == 'F': self.state = 'G' return 7 elif self.state == 'G': self.state = 'E' return 9 else: raise KeyError def chain(self): if self.state == 'B': self.state = 'E' return 2 elif self.state == 'C': self.state = 'C' return 4 elif self.state == 'D': self.state = 'E' return 5 elif self.state == 'E': self.state = 'F' return 6 elif self.state == 'F': self.state = 'F' return 8 else: raise KeyError" "class main: def __init__(self) -> None: self.level = 0 def stall(self): if self.level == 0: self.level = 1 return 0 else: raise KeyError() def erase(self): if self.level == 0: self.level = 1 return 1 elif self.level == 1: self.level = 2 return 3 elif self.level == 2: self.level = 3 return 4 elif self.level == 4: self.level == 4 return 7 else: raise KeyError() def exit(self): if self.level == 0: self.level = 5 return 2 elif self.level == 3: self.level = 4 return 5 elif self.level == 4: self.level = 5 return 6 elif self.level == 5: self.level == 5 return 8 else: raise KeyError()" "class one: a = 11 def pull(self): if self.a == 11: self.a = 0 elif self.a == 1: self.a = 2 elif self.a == 2: self.a = 5 elif self.a in [3, 4]: self.a = 6 elif self.a == 6: self.a = 8 elif self.a == 8: self.a = 9 elif self.a == 10: self.a = 2 else: raise KeyError() return self.a def trim(self): if self.a == 0: self.a = 1 elif self.a == 5: self.a = 1 elif self.a == 1: self.a = 3 elif self.a == 8: self.a = 10 elif self.a == 10: self.a = 3 elif self.a == 2: self.a = 4 elif self.a in [3, 4]: self.a = 7 elif self.a == 7: self.a = 11 elif self.a == 9: self.a = 11 else: raise KeyError() return self.a def main(): return one()" "class StateMachine: state = 'A' def lower(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'C': self.state = 'D' return 4 else: raise KeyError def chain(self): if self.state == 'A': return 1 elif self.state == 'C': return 5 elif self.state == 'D': self.state = 'E' return 6 elif self.state == 'E': self.state = 'F' return 7 else: raise KeyError def fork(self): if self.state == 'B': self.state = 'C' return 3 if self.state == 'A': self.state = 'E' return 2 if self.state == 'F': return 8 else: raise KeyError def main(): return StateMachine()" "class Main(object): state = 'A' def __init__(self): pass def wreck(self): if self.state == 'A': return 1 elif self.state == 'B': self.state = 'C' return 2 elif self.state == 'C': self.state = 'G' return 4 elif self.state == 'D': self.state = 'E' return 6 elif self.state == 'E': self.state = 'F' return 7 else: raise KeyError def log(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'C': self.state = 'D' return 3 elif self.state == 'H': self.state = 'A' return 11 else: raise KeyError def erase(self): if self.state == 'C': self.state = 'A' return 5 elif self.state == 'E': self.state = 'G' return 8 elif self.state == 'F': self.state = 'G' return 9 elif self.state == 'G': self.state = 'H' return 10 else: raise KeyError def main(): return Main()" "def main(): return mealy() class mealy: def __init__(self): self.x = 'a' def rush(self): if self.x == 'a': self.x = 'b' return 0 elif self.x == 'e': self.x = 'a' return 8 elif self.x == 'g': self.x = 'h' return 10 else: raise KeyError def rev(self): if self.x == 'a': self.x = 'g' return 1 elif self.x == 'b': self.x = 'c' return 2 else: raise KeyError def patch(self): if self.x == 'e': self.x = 'f' return 6 elif self.x == 'f': self.x = 'g' return 9 elif self.x == 'h': self.x = 'e' return 11 else: raise KeyError def mass(self): if self.x == 'b': self.x = 'd' return 3 elif self.x == 'c': self.x = 'd' return 4 elif self.x == 'e': self.x = 'c' return 7 elif self.x == 'd': self.x = 'e' return 5 else: raise KeyError" "class main: def __init__(self): self.state = 'A' self.path = {'A': [[self.crash, 0, 'B']], 'B': [[self.punch, 1, 'C']], 'C': [[self.boost, 2, 'D']], 'D': [[self.punch, 3, 'E']], 'E': [[self.boost, 5, 'C'], [self.crash, 4, 'F']], 'F': [[self.punch, 6, 'G']], 'G': [[self.boost, 9, 'D'], [self.punch, 7, 'H'], [self.crash, 8, 'C']], 'H': [[self.boost, 10, 'F'], [self.hop, 11, 'A']]} def crash(self): return self.check(self.crash) def punch(self): return self.check(self.punch) def boost(self): return self.check(self.boost) def hop(self): return self.check(self.hop) def check(self, func): elem = [function for function in self.path[self.state] if func == function[0]] if len(elem) != 0: self.state = elem[0][2] return elem[0][1] else: raise KeyError" "class main: def __init__(self): self.condition = 'A' def join(self): if self.condition == 'A': self.condition = 'B' return 0 elif self.condition == 'B': self.condition = 'D' return 3 elif self.condition == 'C': self.condition = 'D' return 4 elif self.condition == 'D': self.condition = 'F' return 7 else: raise KeyError def paste(self): if self.condition == 'B': self.condition = 'C' return 2 elif self.condition == 'A': self.condition = 'F' return 1 elif self.condition == 'D': self.condition = 'E' return 6 elif self.condition == 'E': self.condition = 'F' return 8 elif self.condition == 'C': self.condition = 'F' return 5 else: raise KeyError" "class main: stat = 'A' def tag(self): match self.stat: case 'A': self.stat = 'B' return 0 case 'B': raise KeyError case 'C': self.stat = 'C' return 3 case 'D': self.stat = 'E' return 4 case 'E': self.stat = 'E' return 7 case 'F': raise KeyError def init(self): match self.stat: case 'A': raise KeyError case 'B': self.stat = 'C' return 1 case 'C': self.stat = 'D' return 2 case 'D': self.stat = 'F' return 5 case 'E': self.stat = 'F' return 6 case 'F': self.stat = 'B' return 8" "class exe_9: def __init__(self): self.current_state = 'a' self.states = dict() self.nextStates = dict() indexes = ['a', 'b', 'c', 'd', 'e', 'f'] arguments = [[0, 1, 2], ['keyError', 3, 'keyError'], [4, 'keyError', 'keyError'], ['keyError', 'keyError', 5], ['keyError', 7, 6], ['keyError', 8, 'keyError']] newSt = [['b', 'd', 'a'], ['b', 'c', 'b'], ['d', 'c', 'c'], ['d', 'd', 'e'], ['e', 'e', 'f'], ['f', 'a', 'f']] for i in range(len(indexes)): self.states[indexes[i]] = arguments[i] self.nextStates[indexes[i]] = newSt[i] def build(self): res = self.states[self.current_state][2] self.current_state = self.nextStates[self.current_state][2] if res == 'keyError': self.states[res] return res def race(self): res = self.states[self.current_state][1] self.current_state = self.nextStates[self.current_state][1] if res == 'keyError': self.states[res] return res def snap(self): res = self.states[self.current_state][0] self.current_state = self.nextStates[self.current_state][0] if res == 'keyError': self.states[res] return res def main(): obj = exe_9() return obj" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class FSM: state = State.A def melt(self): return self.update({State.A: [State.B, 0], State.B: [State.F, 4], State.C: [State.D, 5], State.E: [State.F, 7]}) def log(self): return self.update({State.A: [State.C, 1], State.B: [State.C, 2]}) def close(self): return self.update({State.B: [State.D, 3], State.D: [State.E, 6], State.E: [State.C, 8]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return FSM()" "class FSM: states = dict(A=[[0, 'B'], [9, '-']], B=[[10, '-'], [1, 'C']], C=[[10, '-'], [2, 'D']], D=[[3, 'E'], [4, 'A']], E=[[5, 'F'], [6, 'A']], F=[[10, '-'], [7, 'G']], G=[[8, 'A'], [9, 'G']]) def __init__(self): self.state = 'A' def wreck(self): if self.states[self.state][0][1] == '-': raise KeyError else: a = self.states[self.state][0][0] self.state = self.states[self.state][0][1] return a def stop(self): if self.states[self.state][1][1] == '-': raise KeyError else: a = self.states[self.state][1][0] self.state = self.states[self.state][1][1] return a def main(): obj = FSM() return obj" "class main: def __init__(self): self.state = 'A' def hurry(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 1 elif self.state == 'C': self.state = 'F' return 5 elif self.state == 'D': self.state = 'A' return 7 elif self.state == 'E': self.state = 'F' return 8 else: raise KeyError def mask(self): if self.state == 'B': self.state = 'D' return 3 elif self.state == 'C': self.state = 'D' return 4 elif self.state == 'D': self.state = 'E' return 6 else: raise KeyError def cue(self): if self.state == 'B': self.state = 'E' return 2 else: raise KeyError" "class main: def __init__(self): self.condition = 'A' def open(self): if self.condition == 'A': self.condition = 'C' return 1 elif self.condition == 'C': self.condition = 'D' return 3 elif self.condition == 'D': self.condition = 'E' return 5 elif self.condition == 'G': self.condition = 'D' return 10 else: raise KeyError def fork(self): if self.condition == 'A': self.condition = 'B' return 0 elif self.condition == 'E': self.condition = 'F' return 6 elif self.condition == 'F': self.condition = 'G' return 7 else: raise KeyError def merge(self): if self.condition == 'B': self.condition = 'C' return 2 elif self.condition == 'C': self.condition = 'E' return 4 elif self.condition == 'G': self.condition = 'G' return 11 else: raise KeyError def amble(self): if self.condition == 'F': self.condition = 'D' return 8 elif self.condition == 'G': self.condition = 'H' return 9 else: raise KeyError" "class main: def __init__(self): self.condition = 'A' def hop(self): if self.condition == 'A': self.condition = 'B' return 0 elif self.condition == 'B': self.condition = 'D' return 2 elif self.condition == 'E': self.condition = 'F' return 5 elif self.condition == 'G': self.condition = 'H' return 9 elif self.condition == 'H': self.condition = 'F' return 10 else: raise KeyError def trim(self): if self.condition == 'B': self.condition = 'C' return 1 elif self.condition == 'E': self.condition = 'G' return 6 elif self.condition == 'F': self.condition = 'G' return 8 else: raise KeyError def walk(self): if self.condition == 'C': self.condition = 'D' return 3 elif self.condition == 'D': self.condition = 'E' return 4 elif self.condition == 'E': self.condition = 'B' return 7 elif self.condition == 'H': self.condition = 'H' return 11 else: raise KeyError" "class M: def __init__(self): self.state = 'A' def spawn(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 2 elif self.state == 'C': self.state = 'D' return 4 elif self.state == 'D': self.state = 'A' return 7 else: raise KeyError def color(self): if self.state == 'A': self.state = 'C' return 1 elif self.state == 'B': self.state = 'D' return 3 elif self.state == 'C': self.state = 'F' return 5 elif self.state == 'D': self.state = 'E' return 6 else: raise KeyError def chat(self): if self.state == 'E': self.state = 'F' return 8 else: raise KeyError def main(): obj = M() return obj" "class M: def __init__(self): self.state = 'A' def stash(self): if self.state == 'A': return 1 elif self.state == 'C': self.state = 'D' return 4 elif self.state == 'D': self.state = 'E' return 5 elif self.state == 'E': self.state = 'F' return 7 elif self.state == 'F': self.state = 'A' return 8 else: raise KeyError def run(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 3 else: raise KeyError def group(self): if self.state == 'A': self.state = 'E' return 2 if self.state == 'D': self.state = 'B' return 6 else: raise KeyError def main(): obj = M() return obj" "class Mainly: def __init__(self): self.state = -1 def check(self): if self.state == -1: self.state = 0 elif self.state == 6: self.state = 7 else: raise KeyError return self.state def rock(self): if self.state == -1: self.state = 3 else: raise KeyError return self.state def paste(self): if self.state == -1: self.state = 1 elif self.state == 1 or self.state == 7: self.state = 9 elif self.state == 5: self.state = 6 elif self.state == 6: self.state = 8 else: raise KeyError return self.state def fetch(self): if self.state == -1: self.state = 2 elif self.state == 0: self.state = 4 elif self.state == 4 or self.state == 3 or self.state == 8: self.state = 5 else: raise KeyError return self.state def main(): return Mainly()" "class FSM: states = dict(A=[[0, 'B'], [1, 'E']], B=[[2, 'C'], [2, '-']], C=[[3, '-'], [3, 'D']], D=[[4, 'E'], [5, 'B']], E=[[7, 'C'], [6, 'F']], F=[[8, 'D'], [9, '-']]) def __init__(self): self.state = 'A' def amass(self): if self.states[self.state][1][1] == '-': raise KeyError else: a = self.states[self.state][1][0] self.state = self.states[self.state][1][1] return a def unite(self): if self.states[self.state][0][1] == '-': raise KeyError else: a = self.states[self.state][0][0] self.state = self.states[self.state][0][1] return a def main(): obj = FSM() return obj" "class M: def __init__(self): self.state = 'A' def pluck(self): if self.state == 'A': self.state = 'C' return 1 elif self.state == 'C': self.state = 'D' return 4 elif self.state == 'B': return 3 elif self.state == 'E': self.state = 'F' return 6 elif self.state == 'F': self.state = 'B' return 8 else: raise KeyError def crash(self): if self.state == 'A': self.state = 'B' return 0 if self.state == 'B': self.state = 'C' return 2 elif self.state == 'D': self.state = 'E' return 5 elif self.state == 'E': self.state = 'B' return 7 else: raise KeyError def main(): obj = M() return obj" "class main: startletter = 'A' stayKeys = {'A': '0B', 'D': '6B', 'E': '7F'} rigKeys = {'A': '1C', 'B': '2C', 'E': '8A', 'D': '4E'} crawlKeys = {'D': '5D', 'C': '3D'} def stay(self): temp_drive = self.startletter if self.stayKeys.get(temp_drive, 'KeyError')[1] != 'e': self.startletter = self.stayKeys.get(temp_drive, 'KeyError')[1] return int(self.stayKeys.get(temp_drive)[0]) else: raise KeyError def rig(self): temp_fetch = self.startletter if self.rigKeys.get(temp_fetch, 'KeyError')[1] != 'e': self.startletter = self.rigKeys.get(temp_fetch, 'KeyError')[1] return int(self.rigKeys.get(temp_fetch)[0]) else: raise KeyError def crawl(self): temp_fetch = self.startletter if self.crawlKeys.get(temp_fetch, 'KeyError')[1] != 'e': self.startletter = self.crawlKeys.get(temp_fetch, 'KeyError')[1] return int(self.crawlKeys.get(temp_fetch)[0]) else: raise KeyError" "class Mili: def __init__(self): self.state = 'a' pass def build(self): s = self.state if s == 'a': self.state = 'b' return 0 elif s == 'b': self.state = 'c' return 1 elif s == 'c': self.state = 'd' return 2 elif s == 'd': self.state = 'e' return 4 elif s == 'e': self.state = 'f' return 7 raise KeyError() def pull(self): s = self.state if s == 'c': self.state = 'g' return 3 elif s == 'd': self.state = 'b' return 5 elif s == 'f': return 9 raise KeyError() def spin(self): s = self.state if s == 'd' or s == 'f': self.state = 'g' return 6 if s == 'd' else 8 raise KeyError() def main(): return Mili()" "class Mili: def __init__(self): self.state = 'A' def slur(self): if self.state == 'A': self.state = 'B' return 0 if self.state == 'B': self.state = 'C' return 1 if self.state == 'C': self.state = 'D' return 3 if self.state == 'D': self.state = 'E' return 4 if self.state == 'E': self.state = 'F' return 6 if self.state == 'F': self.state = 'G' return 8 raise KeyError def order(self): if self.state == 'B': self.state = 'G' return 2 if self.state == 'D': self.state = 'B' return 5 if self.state == 'E': self.state = 'A' return 7 if self.state == 'F': self.state = 'D' return 9 raise KeyError def main(): o = Mili() return o" "class FSM: def __init__(self): self.A = 'A' self.B = 'B' self.C = 'C' self.D = 'D' self.E = 'E' self.F = 'F' self.G = 'G' self.H = 'H' self.start = self.A self.current_state = self.start def stop(self): if self.current_state == self.A: self.current_state = self.B return 0 elif self.current_state == self.B: self.current_state = self.C return 2 elif self.current_state == self.D: self.current_state = self.G return 7 elif self.current_state == self.C: self.current_state = self.H return 4 elif self.current_state == self.F: self.current_state = self.G return 9 else: raise KeyError def shift(self): if self.current_state == self.A: self.current_state = self.F return 1 elif self.current_state == self.G: self.current_state = self.B return 11 elif self.current_state == self.C: self.current_state = self.E return 5 elif self.current_state == self.D: self.current_state = self.E return 6 else: raise KeyError def clone(self): if self.current_state == self.C: self.current_state = self.D return 3 elif self.current_state == self.E: self.current_state = self.F return 8 elif self.current_state == self.G: self.current_state = self.H return 10 else: raise KeyError def main(): evaluator = FSM() return evaluator" "class StateMachine: state = 'A' def skew(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'C': self.state = 'D' return 4 elif self.state == 'D': self.state = 'E' return 5 elif self.state == 'E': self.state = 'C' return 7 elif self.state == 'F': self.state = 'G' return 8 else: raise KeyError def get(self): if self.state == 'A': self.state = 'D' return 1 elif self.state == 'B': self.state = 'C' return 3 elif self.state == 'E': self.state = 'F' return 6 else: raise KeyError def brake(self): if self.state == 'A': self.state = 'C' return 2 elif self.state == 'G': self.state = 'E' return 9 else: raise KeyError def main(): return StateMachine()" "class main: def __init__(self): self.state = 'A' def wreck(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'C': self.state = 'D' return 3 elif self.state == 'E': self.state = 'C' return 8 elif self.state == 'G': self.state = 'H' return 10 elif self.state == 'H': self.state = 'E' return 11 else: raise KeyError() def begin(self): if self.state == 'B': self.state = 'C' return 2 elif self.state == 'C': self.state = 'G' return 5 elif self.state == 'D': self.state = 'E' return 6 elif self.state == 'E': self.state = 'F' return 7 elif self.state == 'F': self.state = 'G' return 9 else: raise KeyError() def step(self): if self.state == 'A': self.state = 'F' return 1 elif self.state == 'C': self.state = 'H' return 4 else: raise KeyError() def main(self): return main()" "class StateMachine: state = 'A' def patch(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 1 elif self.state == 'C': self.state = 'D' return 3 elif self.state == 'D': self.state = 'E' return 4 elif self.state == 'E': self.state = 'G' return 6 elif self.state == 'F': self.state = 'G' return 7 elif self.state == 'G': return 9 else: raise KeyError def look(self): if self.state == 'B': return 2 elif self.state == 'F': self.state = 'B' return 8 elif self.state == 'E': self.state = 'F' return 5 else: raise KeyError def main(): return StateMachine()" "class main: def __init__(self): self.d = {'A': {'B': 0, 'G': 1}, 'B': {'G': 3, 'C': 2}, 'C': {'E': 5, 'D': 4}, 'D': {'E': 6, ' ': None}, 'E': {'F': 7, ' ': None}, 'F': {'G': 8, 'D': 9}, 'G': {'H': 10, 'C': 11}} self.char = 'A' self.num = 0 def jump(self): for (key, value) in self.d.get(self.char).items(): if isinstance(value, int): self.char = key self.num = value else: raise KeyError break return self.num def roam(self): i = 0 for (key, value) in self.d.get(self.char).items(): if i == 1: if isinstance(value, int): self.char = key self.num = value else: raise KeyError break i += 1 return self.num" "class StateMachine: state = 'A' def zoom(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'C': self.state = 'D' return 3 elif self.state == 'E': self.state = 'G' return 7 else: raise KeyError def join(self): if self.state == 'A': return 1 elif self.state == 'B': self.state = 'C' return 2 elif self.state == 'D': self.state = 'E' return 4 elif self.state == 'F': self.state = 'C' return 9 else: raise KeyError def pan(self): if self.state == 'D': self.state = 'A' return 5 elif self.state == 'E': self.state = 'F' return 6 elif self.state == 'F': self.state = 'G' return 8 else: raise KeyError def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class StateMachine: state = State.A def look(self): return self.update({State.A: [State.B, 0], State.C: [State.D, 2], State.D: [State.B, 6], State.F: [State.C, 9]}) def throw(self): return self.update({State.B: [State.C, 1], State.C: [State.A, 3], State.D: [State.E, 4], State.E: [State.F, 7], State.F: [State.G, 8]}) def apply(self): return self.update({State.D: [State.G, 5]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main: def __init__(self): self.condition = 'A' def crack(self): if self.condition == 'A': self.condition = 'B' return 0 elif self.condition == 'B': self.condition = 'C' return 1 elif self.condition == 'C': self.condition = 'D' return 3 elif self.condition == 'E': self.condition = 'B' return 7 else: raise KeyError def look(self): if self.condition == 'B': self.condition = 'F' return 2 elif self.condition == 'D': self.condition = 'E' return 5 elif self.condition == 'E': self.condition = 'C' return 8 elif self.condition == 'C': self.condition = 'C' return 4 else: raise KeyError def file(self): if self.condition == 'E': self.condition = 'F' return 6 else: raise KeyError" "class Miles_FSM: def __init__(self): self.state = 'A' def crack(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'C': self.state = 'G' return 3 elif self.state == 'F': self.state = 'G' return 8 elif self.state == 'D': self.state = 'B' return 6 else: raise KeyError def chalk(self): if self.state == 'B': self.state = 'C' return 1 elif self.state == 'D': self.state = 'E' return 4 elif self.state == 'E': self.state = 'F' return 7 else: raise KeyError def fetch(self): if self.state == 'C': self.state = 'D' return 2 elif self.state == 'D': self.state = 'D' return 5 elif self.state == 'G': self.state = 'G' return 9 else: raise KeyError def main(): obj = Miles_FSM() return obj" "class main: def __init__(self): self.condition = 'A' def copy(self): if self.condition == 'A': self.condition = 'B' return 0 elif self.condition == 'B': self.condition = 'C' return 1 elif self.condition == 'D': self.condition = 'E' return 4 elif self.condition == 'E': self.condition = 'C' return 6 elif self.condition == 'H': self.condition = 'E' return 11 elif self.condition == 'F': self.condition = 'G' return 7 else: raise KeyError def coast(self): if self.condition == 'C': self.condition = 'D' return 3 elif self.condition == 'F': self.condition = 'D' return 8 elif self.condition == 'E': self.condition = 'F' return 5 elif self.condition == 'H': self.condition = 'F' return 10 elif self.condition == 'B': self.condition = 'G' return 2 elif self.condition == 'G': self.condition = 'H' return 9 else: raise KeyError" "class MyClass: state = 'A' def __init__(self): self.state = 'A' def hoard(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'C': self.state = 'D' return 3 elif self.state == 'D': self.state = 'F' return 6 elif self.state == 'F': self.state = 'F' return 8 else: raise KeyError def send(self): if self.state == 'A': self.state = 'D' return 1 elif self.state == 'B': self.state = 'C' return 2 elif self.state == 'C': self.state = 'E' return 4 elif self.state == 'D': self.state = 'E' return 5 elif self.state == 'E': self.state = 'F' return 7 else: raise KeyError def main(): return MyClass()" "class main: def __init__(self): self.condition = 'A' def tread(self): if self.condition == 'A': self.condition = 'B' return 0 elif self.condition == 'C': self.condition = 'D' return 2 elif self.condition == 'D': self.condition = 'E' return 3 elif self.condition == 'F': self.condition = 'C' return 7 elif self.condition == 'G': self.condition = 'G' return 8 elif self.condition == 'E': self.condition = 'C' return 5 else: raise KeyError def clean(self): if self.condition == 'B': self.condition = 'C' return 1 elif self.condition == 'E': self.condition = 'F' return 4 elif self.condition == 'F': self.condition = 'G' return 6 elif self.condition == 'G': self.condition = 'D' return 9 else: raise KeyError" "class main: def __init__(self): self.condition = 'A' def roam(self): if self.condition == 'A': self.condition = 'B' return 0 elif self.condition == 'B': self.condition = 'C' return 1 elif self.condition == 'C': self.condition = 'D' return 3 elif self.condition == 'E': self.condition = 'F' return 6 elif self.condition == 'G': self.condition = 'H' return 9 elif self.condition == 'H': self.condition = 'H' return 10 else: raise KeyError def slog(self): if self.condition == 'B': self.condition = 'H' return 2 elif self.condition == 'C': self.condition = 'C' return 4 elif self.condition == 'D': self.condition = 'E' return 5 elif self.condition == 'F': self.condition = 'G' return 8 elif self.condition == 'E': self.condition = 'H' return 7 elif self.condition == 'H': self.condition = 'A' return 11 else: raise KeyError" "class Node: def __init__(self): self.data = None self.status = 'A' def play(self): if self.status == 'A': self.data = 0 self.status = 'B' elif self.status == 'D': self.data = 6 self.status = 'B' else: raise KeyError return self.data def tag(self): if self.status == 'A': self.data = 2 self.status = 'E' elif self.status == 'B': self.data = 3 self.status = 'C' elif self.status == 'D': self.data = 5 self.status = 'E' else: raise KeyError return self.data def bolt(self): if self.status == 'A': self.data = 1 self.status = 'D' elif self.status == 'C': self.data = 4 self.status = 'D' elif self.status == 'E': self.data = 7 self.status = 'F' elif self.status == 'F': self.data = 8 self.status = 'F' else: raise KeyError return self.data def main(): return Node()" "class StateMachine: state = 'A' def shade(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 1 elif self.state == 'C': self.state = 'D' return 3 elif self.state == 'D': self.state = 'E' return 5 elif self.state == 'E': self.state = 'F' return 7 else: raise KeyError def copy(self): if self.state == 'B': self.state = 'D' return 2 elif self.state == 'C': self.state = 'E' return 4 elif self.state == 'D': self.state = 'G' return 6 elif self.state == 'E': self.state = 'A' return 8 elif self.state == 'F': self.state = 'G' return 9 else: raise KeyError def main(): return StateMachine()" "class main: def __init__(self): self.condition = 'A' def chalk(self): if self.condition == 'A': self.condition = 'B' return 0 elif self.condition == 'B': self.condition = 'C' return 3 elif self.condition == 'C': self.condition = 'C' return 5 elif self.condition == 'D': self.condition = 'E' return 6 else: raise KeyError def cue(self): if self.condition == 'A': self.condition = 'D' return 2 elif self.condition == 'C': self.condition = 'D' return 4 elif self.condition == 'E': self.condition = 'F' return 7 elif self.condition == 'F': self.condition = 'G' return 8 else: raise KeyError def crush(self): if self.condition == 'F': self.condition = 'A' return 9 elif self.condition == 'A': self.condition = 'E' return 1 else: raise KeyError" "import re class main: now_letter = 'A' slov_drag = {'A': '0B', 'C': '3D', 'D': '6G'} slov_stare = {'B': '1C', 'C': '4A', 'D': '5E', 'F': '8G'} slov_hop = {'B': '2D', 'E': '7F', 'F': '9C'} def drag(self): temp_drag = self.now_letter num = '' letter = '' if self.slov_drag.get(temp_drag, 'KeyError')[1] != 'e': let = re.findall('\\D', self.slov_drag.get(temp_drag, 'KeyError')) for e in let: letter += str(e) self.now_letter = letter number = re.findall('\\d', self.slov_drag.get(temp_drag)) for e in number: num += str(e) return int(num) else: raise KeyError def stare(self): temp_stare = self.now_letter num = '' letter = '' if self.slov_stare.get(temp_stare, 'KeyError')[1] != 'e': let = re.findall('\\D', self.slov_stare.get(temp_stare, 'KeyError')) for e in let: letter += str(e) self.now_letter = letter number = re.findall('\\d', self.slov_stare.get(temp_stare)) for e in number: num += str(e) return int(num) else: raise KeyError def hop(self): temp_hop = self.now_letter num = '' letter = '' if self.slov_hop.get(temp_hop, 'KeyError')[1] != 'e': let = re.findall('\\D', self.slov_hop.get(temp_hop, 'KeyError')) for e in let: letter += str(e) self.now_letter = letter number = re.findall('\\d', self.slov_hop.get(temp_hop)) for e in number: num += str(e) return int(num) else: raise KeyError" "class main: def __init__(self): self.state = 'A' self.graph = {('A', 'dash'): ('B', 0), ('A', 'amass'): ('F', 1), ('B', 'dash'): ('F', 3), ('B', 'amass'): ('C', 2), ('B', 'slog'): ('D', 5), ('B', 'push'): ('G', 4), ('C', 'push'): ('D', 6), ('C', 'amass'): ('F', 7), ('D', 'push'): ('E', 8), ('E', 'dash'): ('F', 9), ('F', 'push'): ('G', 10), ('G', 'amass'): ('H', 11)} def dash(self): (self.state, ret) = self.graph[self.state, 'dash'] return ret def amass(self): (self.state, ret) = self.graph[self.state, 'amass'] return ret def push(self): (self.state, ret) = self.graph[self.state, 'push'] return ret def slog(self): (self.state, ret) = self.graph[self.state, 'slog'] return ret" "class FSM: def __init__(self): self.A = 'A' self.B = 'B' self.C = 'C' self.D = 'D' self.E = 'E' self.F = 'F' self.G = 'G' self.start = self.A self.current_state = self.start def step(self): if self.current_state == self.A: return 1 elif self.current_state == self.C: self.current_state = self.D return 4 elif self.current_state == self.F: self.current_state = self.C return 8 else: raise KeyError def clone(self): if self.current_state == self.A: self.current_state = self.B return 0 elif self.current_state == self.B: self.current_state = self.C return 3 elif self.current_state == self.D: self.current_state = self.E return 5 elif self.current_state == self.G: self.current_state = self.B return 9 else: raise KeyError def visit(self): if self.current_state == self.A: self.current_state = self.G return 2 elif self.current_state == self.E: self.current_state = self.F return 6 elif self.current_state == self.F: self.current_state = self.G return 7 else: raise KeyError def main(): state_machine = FSM() return state_machine" "class MileZ: current_state = 'A' def stall(self): if self.current_state == 'A': self.current_state = 'B' return 0 elif self.current_state == 'D': self.current_state = 'E' return 3 elif self.current_state == 'F': self.current_state = 'G' return 5 elif self.current_state == 'H': self.current_state = 'C' return 9 else: raise KeyError def slog(self): if self.current_state == 'B': self.current_state = 'C' return 1 elif self.current_state == 'C': self.current_state = 'D' return 2 elif self.current_state == 'F': self.current_state = 'B' return 6 elif self.current_state == 'G': self.current_state = 'H' return 7 elif self.current_state == 'H': return 11 else: raise KeyError def boost(self): if self.current_state == 'E': self.current_state = 'F' return 4 elif self.current_state == 'G': self.current_state = 'D' return 8 elif self.current_state == 'H': self.current_state = 'F' return 10 else: raise KeyError def main(): o = MileZ() return o" "class MealyMachine: def __init__(self): self.state = 'A' def cast(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 1 elif self.state == 'C': self.state = 'D' return 2 elif self.state == 'D': self.state = 'E' return 3 elif self.state == 'E': self.state = 'F' return 5 elif self.state == 'F': self.state = 'B' return 8 else: raise KeyError() def skip(self): if self.state == 'D': return 4 elif self.state == 'E': self.state = 'B' return 6 elif self.state == 'F': self.state = 'C' return 7 else: raise KeyError() def main(): return MealyMachine()" "class main: name = 'A' map_of_actions = {'A': 'bolt 0 B', 'B': 'bolt 1 C', 'C': 'bolt 2 D merge 3 A', 'D': 'bolt 6 A merge 5 B pose 4 E', 'E': 'bolt 8 B pose 7 F'} def __init__(self): pass def template(self, function_name): actions = self.map_of_actions[self.name].split(' ') for i in range(0, len(actions), 3): if actions[i] == function_name: self.name = actions[i + 2] return int(actions[i + 1]) raise KeyError def bolt(self): return self.template('bolt') def merge(self): return self.template('merge') def pose(self): return self.template('pose')" "class main: def __init__(self): self._state = 'A' self._graph = {('A', 'coat'): ('B', 0), ('B', 'coast'): ('C', 1), ('B', 'coat'): ('D', 2), ('C', 'coat'): ('A', 4), ('C', 'coast'): ('D', 3), ('D', 'coast'): ('E', 5), ('E', 'coast'): ('F', 6), ('F', 'coat'): ('B', 8), ('F', 'coast'): ('A', 7)} def coat(self): (self._state, ret) = self._graph[self._state, 'coat'] return ret def coast(self): (self._state, ret) = self._graph[self._state, 'coast'] return ret" "class main: def __init__(self): self._state = 'A' self._graph = {('A', 'bend'): ('B', 0), ('A', 'brake'): ('C', 1), ('B', 'bend'): ('C', 2), ('C', 'brake'): ('D', 3), ('D', 'brake'): ('E', 4), ('D', 'bend'): ('D', 5), ('E', 'click'): ('F', 6), ('F', 'brake'): ('B', 7), ('F', 'click'): ('D', 8)} def bend(self): (self._state, ret) = self._graph[self._state, 'bend'] return ret def brake(self): (self._state, ret) = self._graph[self._state, 'brake'] return ret def click(self): (self._state, ret) = self._graph[self._state, 'click'] return ret" "class StateMachine: state = 'A' def run(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 1 elif self.state == 'C': self.state = 'D' return 4 elif self.state == 'F': self.state = 'D' return 8 else: raise KeyError def unite(self): if self.state == 'B': self.state = 'D' return 2 else: raise KeyError def cull(self): if self.state == 'B': self.state = 'E' return 3 elif self.state == 'C': self.state = 'E' return 5 elif self.state == 'D': self.state = 'E' return 6 elif self.state == 'E': self.state = 'F' return 7 else: raise KeyError def main(): return StateMachine()" "class main: point = 'A' spin1 = {'A': '1A', 'B': '2C', 'D': '5E', 'E': '7E', 'F': '8F'} loop1 = {'A': '0B', 'C': '4D', 'E': '6F', 'B': '3F'} def spin(self): tmp_blame = self.point if self.spin1.get(tmp_blame, 'KeyError')[1] != 'e': self.point = self.spin1.get(tmp_blame, 'KeyError')[1] return int(self.spin1.get(tmp_blame)[0]) else: raise KeyError def loop(self): tmp_view = self.point if self.loop1.get(tmp_view, 'KeyError')[1] != 'e': self.point = self.loop1.get(tmp_view, 'KeyError')[1] return int(self.loop1.get(tmp_view)[0]) else: raise KeyError" "class FSM: def __init__(self): self.state = 'A' def set_state(self, state): self.state = state def get_state(self): return self.state def join(self): match self.get_state(): case 'A': self.set_state('B') return 0 case 'B': self.set_state('C') return 2 case 'F': self.set_state('C') return 9 case 'D': self.set_state('E') return 6 case _: raise KeyError('KeyError') def wreck(self): match self.get_state(): case 'B': self.set_state('D') return 3 case 'F': self.set_state('G') return 8 case _: raise KeyError('KeyError') def drag(self): match self.get_state(): case 'A': self.set_state('E') return 1 case 'C': self.set_state('D') return 5 case 'E': self.set_state('F') return 7 case 'B': self.set_state('H') return 4 case 'F': self.set_state('H') return 10 case 'G': self.set_state('H') return 11 case _: raise KeyError('KeyError') def main(): return FSM()" "class Node: def __init__(self): self.data = None self.status = 'A' def smash(self): if self.status == 'A': self.data = 0 self.status = 'B' elif self.status == 'C': self.data = 6 self.status = 'G' else: raise KeyError return self.data def add(self): if self.status == 'A': self.data = 2 self.status = 'C' elif self.status == 'C': self.data = 5 self.status = 'D' elif self.status == 'E': self.data = 8 self.status = 'F' else: raise KeyError return self.data def boost(self): if self.status == 'A': self.data = 3 self.status = 'F' elif self.status == 'B': self.data = 4 self.status = 'C' elif self.status == 'F': self.data = 9 self.status = 'G' else: raise KeyError return self.data def walk(self): if self.status == 'A': self.data = 1 self.status = 'D' elif self.status == 'D': self.data = 7 self.status = 'E' elif self.status == 'G': self.data = 10 self.status = 'H' elif self.status == 'H': self.data = 11 self.status = 'D' else: raise KeyError return self.data def main(): return Node()" "class main: def __init__(self): self.__state = 'A' def view(self): if self.__state == 'A': self.__state = 'B' return 0 if self.__state == 'C': self.__state = 'E' return 6 if self.__state == 'E': self.__state = 'F' return 8 raise KeyError def edit(self): if self.__state == 'A': self.__state = 'D' return 2 if self.__state == 'C': self.__state = 'D' return 4 if self.__state == 'B': self.__state = 'C' return 3 if self.__state == 'D': self.__state = 'E' return 7 raise KeyError def bend(self): if self.__state == 'C': self.__state = 'A' return 5 if self.__state == 'A': self.__state = 'E' return 1 raise KeyError" "class main: def __init__(self): self.__state = 'A' def build(self): if self.__state == 'A': self.__state = 'B' return 0 if self.__state == 'B': self.__state = 'C' return 1 if self.__state == 'C': self.__state = 'F' return 5 if self.__state == 'D': self.__state = 'E' return 6 if self.__state == 'E': self.__state = 'G' return 9 raise KeyError def click(self): if self.__state == 'C': self.__state = 'D' return 4 if self.__state == 'E': return 8 if self.__state == 'B': self.__state = 'G' return 3 if self.__state == 'F': self.__state = 'G' return 10 raise KeyError def place(self): if self.__state == 'B': self.__state = 'H' return 2 if self.__state == 'G': self.__state = 'H' return 11 if self.__state == 'E': self.__state = 'F' return 7 raise KeyError" "class Millie: def __init__(self): self.statement = 'A' self.grow_map = {'A': 'B0', 'B': 'D4', 'D': 'E7', 'C': 'D5'} self.punch_map = {'A': 'E1', 'E': 'F8', 'B': 'C2'} self.join_map = {'B': 'F3', 'C': 'C6'} def grow(self): try: ans = self.grow_map[self.statement] except KeyError as err: raise err self.statement = ans[0] return int(ans[1]) def punch(self): try: ans = self.punch_map[self.statement] except KeyError as err: raise err self.statement = ans[0] return int(ans[1]) def join(self): try: ans = self.join_map[self.statement] except KeyError as err: raise err self.statement = ans[0] return int(ans[1]) def main(): return Millie()" "class MealyMachine: def __init__(self): self.state = -1 def throw(self): if self.state == -1: self.state = 0 elif self.state in [0, 7]: self.state = 2 elif self.state in [4, 1]: self.state = 6 elif self.state == 6: self.state = 8 elif self.state == 2: self.state = 5 elif self.state in [8, 5]: self.state = 9 else: raise KeyError return self.state def jump(self): if self.state == -1: self.state = 1 elif self.state in [4, 1]: self.state = 7 elif self.state in [0, 7]: self.state = 3 elif self.state == 2: self.state = 4 else: raise KeyError return self.state def main(): return MealyMachine()" "class Mili: def __init__(self): self.cur_state = 'A' self.graph = {('A', 'trace'): ('B', 0), ('B', 'link'): ('C', 1), ('B', 'fork'): ('E', 2), ('C', 'trace'): ('C', 4), ('C', 'link'): ('D', 3), ('C', 'fork'): ('H', 5), ('D', 'link'): ('E', 6), ('E', 'fork'): ('F', 7), ('F', 'fork'): ('G', 8), ('G', 'link'): ('H', 9), ('H', 'fork'): ('D', 11), ('H', 'trace'): ('A', 10)} def choose(self, func): try: new = self.graph[self.cur_state, func] except KeyError: raise KeyError from None self.cur_state = new[0] return new[1] def fork(self): return self.choose('fork') def link(self): return self.choose('link') def trace(self): return self.choose('trace') def main(): return Mili()" "class States: A = list() B = list() C = list() D = list() E = list() F = list() class StateMachine: state = States.A def __init__(self): States.A.append(('crawl', 0, States.B)) States.A.append(('add', 1, States.E)) States.B.append(('crawl', 2, States.C)) States.C.append(('add', 3, States.D)) States.D.append(('crawl', 4, States.E)) States.D.append(('add', 5, States.A)) States.E.append(('crawl', 6, States.F)) States.E.append(('add', 8, States.B)) States.E.append(('bend', 7, States.C)) def __get_next_node(self, method_name): found = None for node in self.state: if node[0] == method_name: found = node break return found def base_method(self, next_state): if next_state is not None: self.state = next_state[2] return next_state[1] else: raise KeyError('No such edge!') def add(self): next_state = self.__get_next_node('add') return self.base_method(next_state) def crawl(self): next_state = self.__get_next_node('crawl') return self.base_method(next_state) def bend(self): next_state = self.__get_next_node('bend') return self.base_method(next_state) def main(): return StateMachine()" "class main: def __init__(self): self.state = 'A' def hike(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'F': self.state = 'B' return 8 else: raise KeyError() def hurry(self): if self.state == 'F': self.state = 'F' return 7 elif self.state == 'D': self.state = 'B' return 4 else: raise KeyError() def throw(self): if self.state == 'B': self.state = 'C' return 1 elif self.state == 'C': self.state = 'D' return 2 elif self.state == 'D': self.state = 'E' return 3 elif self.state == 'F': self.state = 'G' return 6 else: raise KeyError() def cast(self): if self.state == 'F': self.state = 'D' return 9 elif self.state == 'E': self.state = 'F' return 5 else: raise KeyError() def main(self): return main()" "class main: def __init__(self): self.state = 'A' def roam(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 1 elif self.state == 'C': self.state = 'D' return 2 elif self.state == 'D': self.state = 'A' return 5 else: raise KeyError() def fork(self): if self.state == 'D': self.state = 'E' return 3 elif self.state == 'E': self.state = 'B' return 7 elif self.state == 'F': self.state = 'C' return 8 else: raise KeyError() def view(self): if self.state == 'D': self.state = 'D' return 4 elif self.state == 'E': self.state = 'F' return 6 else: raise KeyError() def main(self): return main()" "class main: def __init__(self): self.state = 'A' def roam(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 2 elif self.state == 'D': self.state = 'E' return 5 else: raise KeyError() def start(self): if self.state == 'A': self.state = 'A' return 1 elif self.state == 'B': self.state = 'D' return 3 elif self.state == 'C': self.state = 'D' return 4 elif self.state == 'D': self.state = 'G' return 6 elif self.state == 'E': self.state = 'F' return 7 elif self.state == 'F': self.state = 'G' return 8 elif self.state == 'G': self.state = 'E' return 9 else: raise KeyError() def main(self): return main()" "class Mealy: def __init__(self): self.state = 8 self.states = {0: {'sn': 3}, 1: {'sp': 5, 'l': 6}, 2: {'sp': 4}, 3: {'sp': 4}, 4: {'l': 6, 'sp': 5}, 5: {'sn': 8, 'sp': 7}, 6: {'l': 6, 'sp': 5}, 7: {'sp': 9}, 8: {'sp': 1, 'l': 2, 'sn': 0}, 9: {}} def snap(self): self.state = self.states[self.state]['sn'] return self.state def spin(self): self.state = self.states[self.state]['sp'] return self.state def log(self): self.state = self.states[self.state]['l'] return self.state def main(): return Mealy()" "class StateMachine: def __init__(self) -> None: self.state = 'A' def switch(self, state, value) -> int: self.state = state return value def error(self) -> None: raise KeyError() def lower(self) -> None: if self.state == 'A': return self.switch('A', 1) if self.state == 'B': return self.switch('C', 2) if self.state == 'C': return self.switch('C', 4) if self.state == 'D': return self.switch('F', 6) if self.state == 'E': self.error() if self.state == 'F': return self.switch('G', 8) if self.state == 'G': return self.switch('H', 9) if self.state == 'H': return self.switch('E', 11) def tail(self) -> None: if self.state == 'A': return self.switch('B', 0) if self.state == 'B': self.error() if self.state == 'C': return self.switch('D', 3) if self.state == 'D': return self.switch('E', 5) if self.state == 'E': return self.switch('F', 7) if self.state == 'F': self.error() if self.state == 'G': self.error() if self.state == 'H': return self.switch('B', 10) def main(): return StateMachine()" "class StateMachine: state = 'A' def get(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 1 elif self.state == 'D': self.state = 'E' return 4 else: raise KeyError def crack(self): if self.state == 'C': self.state = 'D' return 2 elif self.state == 'D': self.state = 'G' return 5 elif self.state == 'E': self.state = 'F' return 6 elif self.state == 'F': self.state = 'G' return 8 else: raise KeyError def herd(self): if self.state == 'C': self.state = 'E' return 3 elif self.state == 'E': self.state = 'A' return 7 elif self.state == 'F': self.state = 'B' return 9 else: raise KeyError def main(): return StateMachine()" "class main(object): def __init__(self): self.id = 'A' def turn(self): match self.id: case 'A': self.id = 'B' return 0 case 'D': self.id = 'E' return 4 case 'C': self.id = 'F' return 3 case 'F': self.id = 'G' return 8 raise KeyError def clear(self): match self.id: case 'B': self.id = 'C' return 1 case 'D': self.id = 'B' return 5 case 'C': self.id = 'D' return 2 case 'G': self.id = 'C' return 11 case 'F': self.id = 'H' return 9 raise KeyError def pose(self): match self.id: case 'D': self.id = 'F' return 6 case 'E': self.id = 'F' return 7 case 'G': self.id = 'H' return 10 raise KeyError" "class Mily: statements = ['A', 'B', 'C', 'D', 'E', 'F', 'G'] current_statement = 'A' num_change = None def spin(self): if self.current_statement == 'A': self.num_change = 0 self.current_statement = 'B' elif self.current_statement == 'B': self.num_change = 1 self.current_statement = 'C' elif self.current_statement == 'C': self.num_change = 2 self.current_statement = 'D' elif self.current_statement == 'D': self.num_change = 3 self.current_statement = 'E' elif self.current_statement == 'E': self.num_change = 5 self.current_statement = 'E' elif self.current_statement == 'F': self.num_change = 6 self.current_statement = 'G' elif self.current_statement == 'F': self.num_change = 6 self.current_statement = 'G' elif self.current_statement == 'G': self.num_change = 9 self.current_statement = 'C' else: raise KeyError return self.num_change def rush(self): if self.current_statement == 'E': self.num_change = 4 self.current_statement = 'F' elif self.current_statement == 'F': self.num_change = 7 self.current_statement = 'D' elif self.current_statement == 'G': self.num_change = 8 self.current_statement = 'G' else: raise KeyError return self.num_change def main(): m = Mily() return m" "class Milli: def __init__(self): self.curr_state = 'a' def put(self): state = self.curr_state if state == 'a': self.curr_state = 'b' return 0 if state == 'b': self.curr_state = 'c' return 2 if state == 'c': self.curr_state = 'd' return 3 if state == 'd': self.curr_state = 'b' return 6 if state == 'e': self.curr_state = 'g' return 8 if state == 'g': self.curr_state = 'h' return 11 raise KeyError def stash(self): state = self.curr_state if state == 'a': self.curr_state = 'd' return 1 if state == 'd': self.curr_state = 'e' return 4 if state == 'e': self.curr_state = 'f' return 7 if state == 'f': return 10 raise KeyError def patch(self): state = self.curr_state if state == 'd': self.curr_state = 'f' return 5 if state == 'f': self.curr_state = 'g' return 9 raise KeyError def main(): return Milli()" "class o: def __init__(self): self.state = 'A' def snap(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'F': self.state = 'D' return 8 elif self.state == 'G': return 11 else: raise KeyError(self.state) def shade(self): if self.state == 'A': self.state = 'H' return 2 elif self.state == 'G': self.state = 'D' return 10 elif self.state == 'E': self.state = 'F' return 6 else: raise KeyError(self.state) def cast(self): if self.state == 'B': self.state = 'C' return 3 elif self.state == 'C': self.state = 'D' return 4 elif self.state == 'D': self.state = 'E' return 5 elif self.state == 'F': self.state = 'G' return 7 elif self.state == 'G': self.state = 'H' return 9 elif self.state == 'A': self.state = 'G' return 1 else: raise KeyError(self.state) def main(): return o()" "class main: def __init__(self): self.state = 'A' self.graph = {('A', 'patch'): ('B', 0), ('B', 'bend'): ('C', 1), ('C', 'patch'): ('D', 2), ('D', 'bend'): ('E', 3), ('D', 'patch'): ('F', 4), ('E', 'bend'): ('F', 5), ('F', 'patch'): ('C', 7), ('F', 'bend'): ('G', 6), ('G', 'patch'): ('B', 8), ('G', 'bend'): ('A', 9)} def patch(self): (self.state, ret) = self.graph[self.state, 'patch'] return ret def bend(self): (self.state, ret) = self.graph[self.state, 'bend'] return ret" "class main: def __init__(self): self.state = 'A' self.graph = {('A', 'jump'): ('B', 0), ('B', 'jump'): ('C', 1), ('C', 'jump'): ('D', 2), ('D', 'jump'): ('A', 4), ('D', 'trash'): ('E', 3), ('E', 'jump'): ('E', 6), ('E', 'trash'): ('F', 5), ('F', 'trash'): ('D', 7), ('F', 'jump'): ('B', 8)} def jump(self): (self.state, ret) = self.graph[self.state, 'jump'] return ret def trash(self): (self.state, ret) = self.graph[self.state, 'trash'] return ret" "class main: def __init__(self): self._state = 'A' self._graph = {('A', 'pluck'): ('B', 0), ('A', 'crack'): ('D', 1), ('A', 'skip'): ('E', 2), ('B', 'crack'): ('C', 3), ('C', 'skip'): ('A', 5), ('C', 'crack'): ('D', 4), ('D', 'skip'): ('E', 6), ('E', 'skip'): ('F', 7), ('F', 'crack'): ('D', 8)} def pluck(self): (self._state, ret) = self._graph[self._state, 'pluck'] return ret def crack(self): (self._state, ret) = self._graph[self._state, 'crack'] return ret def skip(self): (self._state, ret) = self._graph[self._state, 'skip'] return ret" "class main: def __init__(self): self._state = 'A' self._graph = {('A', 'speed'): ('B', 0), ('A', 'loop'): ('C', 1), ('A', 'visit'): ('G', 3), ('A', 'spin'): ('H', 2), ('B', 'visit'): ('D', 5), ('B', 'loop'): ('C', 4), ('C', 'spin'): ('D', 6), ('D', 'visit'): ('E', 7), ('E', 'spin'): ('F', 8), ('F', 'spin'): ('G', 9), ('G', 'spin'): ('E', 11), ('G', 'visit'): ('H', 10)} def speed(self): (self._state, ret) = self._graph[self._state, 'speed'] return ret def loop(self): (self._state, ret) = self._graph[self._state, 'loop'] return ret def visit(self): (self._state, ret) = self._graph[self._state, 'visit'] return ret def spin(self): (self._state, ret) = self._graph[self._state, 'spin'] return ret" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def model(self): return self.update({State.A: [State.A, 2], State.B: [State.C, 3], State.E: [State.F, 8], State.C: [State.D, 5]}) def mix(self): return self.update({State.A: [State.B, 0], State.B: [State.D, 4], State.D: [State.E, 7]}) def edit(self): return self.update({State.A: [State.D, 1], State.C: [State.F, 6]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class Mili: state = -1 def jump(self): if self.state in [-1, 1]: self.state = 1 elif self.state in [0, 5]: self.state = 2 elif self.state == 3: self.state = 6 else: raise KeyError return self.state def drag(self): if self.state in [-1, 1]: self.state = 0 elif self.state == 2: self.state = 3 elif self.state == 3: self.state = 5 elif self.state == 4: self.state = 7 else: raise KeyError return self.state def trim(self): if self.state == 3: self.state = 4 elif self.state in [7, 6, 8]: self.state = 8 else: raise KeyError return self.state def main(): return Mili()" "class main: def __init__(self): self._cur_state = 'A' def drive(self): if self._cur_state == 'A': self._cur_state = 'B' return 0 if self._cur_state == 'C': self._cur_state = 'E' return 5 raise KeyError() def stop(self): if self._cur_state == 'B': self._cur_state = 'C' return 2 if self._cur_state == 'A': self._cur_state = 'D' return 1 if self._cur_state == 'D': self._cur_state = 'E' return 6 if self._cur_state == 'C': self._cur_state = 'D' return 4 if self._cur_state == 'E': self._cur_state = 'F' return 8 raise KeyError() def fill(self): if self._cur_state == 'D': self._cur_state = 'B' return 7 if self._cur_state == 'B': self._cur_state = 'E' return 3 raise KeyError()" "class Mc: def __init__(self): self.x = 'A' def flip(self): if self.x == 'A': self.x = 'B' return 0 elif self.x == 'C': self.x = 'G' return 5 elif self.x == 'D': self.x = 'E' return 6 else: raise KeyError() def fade(self): if self.x == 'A': self.x = 'C' return 1 elif self.x == 'B': self.x = 'C' return 2 elif self.x == 'C': self.x = 'D' return 4 elif self.x == 'E': self.x = 'F' return 7 elif self.x == 'F': self.x = 'G' return 8 else: raise KeyError() def hike(self): if self.x == 'B': self.x = 'G' return 3 elif self.x == 'G': self.x = 'G' return 9 else: raise KeyError() def main(): zz = Mc() return zz" "class main: def __init__(self): self.dct = {'A': [[self.peek], [0], ['B']], 'B': [[self.peek], [1], ['C']], 'C': [[self.peek], [2], ['D']], 'D': [[self.join, self.step], [3, 4], ['E', 'B']], 'E': [[self.step], [5], ['F']], 'F': [[self.join], [6], ['G']], 'G': [[self.step, self.join, self.peek], [7, 8, 9], ['E', 'G', 'D']]} self.state = 'A' self.k = 0 def peek(self): temp = self.dct[self.state] if self.peek in temp[0]: self.state = temp[2][temp[0].index(self.peek)] self.k = temp[1][temp[0].index(self.peek)] return self.k else: raise KeyError def join(self): temp = self.dct[self.state] if self.join in temp[0]: self.state = temp[2][temp[0].index(self.join)] self.k = temp[1][temp[0].index(self.join)] return self.k else: raise KeyError def step(self): temp = self.dct[self.state] if self.step in temp[0]: self.state = temp[2][temp[0].index(self.step)] self.k = temp[1][temp[0].index(self.step)] return self.k else: raise KeyError" "class main: def __init__(self): self.__state = 'A' def clone(self): if self.__state == 'A': self.__state = 'B' return 0 if self.__state == 'C': self.__state = 'G' return 3 if self.__state == 'D': self.__state = 'G' return 5 if self.__state == 'E': self.__state = 'F' return 6 if self.__state == 'F': self.__state = 'G' return 8 raise KeyError def file(self): if self.__state == 'B': self.__state = 'C' return 1 if self.__state == 'C': self.__state = 'D' return 2 if self.__state == 'D': self.__state = 'E' return 4 if self.__state == 'E': self.__state = 'C' return 7 if self.__state == 'G': self.__state = 'B' return 9 raise KeyError" "class Mili: def __init__(self): self.i = -1 def podmodel(self): if self.i == 0: return 2 elif self.i == 6: return 8 elif self.i == 2 or self.i == 5 or self.i == 7: return 10 else: return -100 def model(self): if self.i == -1 or self.i == 10: self.i = 0 return 0 elif self.i == 3: self.i = 4 return 4 elif self.i == 4 or self.i == 11: self.i = 6 return 6 elif self.podmodel() != -100: self.i = self.podmodel() return self.i else: raise KeyError def file(self): if self.i == 0: self.i = 1 return 1 elif self.i == 2 or self.i == 5 or self.i == 7: self.i = -1 return 9 elif self.i == 6: self.i = 7 return 7 else: raise KeyError def merge(self): if self.i == 1 or self.i == 8: self.i = 3 return 3 elif self.i == 3: self.i = 5 return 5 elif self.i == 2 or self.i == 5 or self.i == 7: self.i = 11 return 11 else: raise KeyError def main(): mili = Mili() return mili" "class StateMachine: state = 'A' def look(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'E' return 3 elif self.state == 'C': self.state = 'D' return 5 else: raise KeyError def trim(self): if self.state == 'B': self.state = 'C' return 1 if self.state == 'F': self.state = 'G' return 8 else: raise KeyError def merge(self): if self.state == 'B': self.state = 'D' return 2 elif self.state == 'D': self.state = 'E' return 6 else: raise KeyError def clone(self): if self.state == 'B': return 4 elif self.state == 'E': self.state = 'F' return 7 elif self.state == 'F': self.state = 'C' return 9 else: raise KeyError def main(): return StateMachine()" "class StateMachine: state = 'A' def crush(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'H' return 4 elif self.state == 'D': self.state = 'E' return 6 elif self.state == 'F': self.state = 'C' return 10 else: raise KeyError def order(self): if self.state == 'A': self.state = 'C' return 1 elif self.state == 'B': self.state = 'C' return 3 elif self.state == 'C': self.state = 'D' return 5 elif self.state == 'F': self.state = 'A' return 9 elif self.state == 'G': self.state = 'H' return 11 else: raise KeyError def sit(self): if self.state == 'A': self.state = 'H' return 2 elif self.state == 'E': self.state = 'F' return 7 elif self.state == 'F': self.state = 'G' return 8 else: raise KeyError def main(): return StateMachine()" "class main: def __init__(self): self.curr_state = 'A' self.states = {'A': [None, 'B', 'F'], 'B': ['C', None, None], 'C': ['D', 'C', None], 'D': [None, 'E', None], 'E': [None, 'F', None], 'F': ['F', None, 'C']} self.state_key = {'A': [None, 0, 1], 'B': [2], 'C': [3, 4], 'D': [None, 5], 'E': [None, 6], 'F': [8, None, 7]} def glare(self): if self.states[self.curr_state][0]: last_state = self.curr_state self.curr_state = self.states[self.curr_state][0] return self.state_key[last_state][0] raise KeyError() def zoom(self): if self.states[self.curr_state][1]: last_state = self.curr_state self.curr_state = self.states[self.curr_state][1] return self.state_key[last_state][1] raise KeyError() def stop(self): if self.states[self.curr_state][2]: last_state = self.curr_state self.curr_state = self.states[self.curr_state][2] return self.state_key[last_state][2] raise KeyError()" "def main(): class auto: def __init__(self): self.state = 'A' def tread(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'C': return 3 elif self.state == 'D': return 5 elif self.state == 'E': self.state = 'F' return 6 elif self.state == 'H': self.state = 'D' return 9 else: raise KeyError def hop(self): if self.state == 'B': self.state = 'C' return 1 elif self.state == 'D': self.state = 'E' return 4 elif self.state == 'F': self.state = 'G' return 7 elif self.state == 'G': self.state = 'H' return 8 elif self.state == 'H': self.state = 'E' return 11 else: raise KeyError def check(self): if self.state == 'C': self.state = 'D' return 2 elif self.state == 'H': self.state = 'B' return 10 else: raise KeyError return auto()" "class main: def __init__(self): self._state = 'A' self._graph = {('A', 'clone'): ('B', 0), ('A', 'trace'): ('C', 1), ('B', 'trace'): ('C', 2), ('C', 'clone'): ('D', 3), ('C', 'trace'): ('G', 4), ('D', 'clone'): ('E', 5), ('D', 'trace'): ('D', 6), ('E', 'clone'): ('F', 7), ('F', 'clone'): ('G', 8), ('F', 'trace'): ('C', 9)} def clone(self): (self._state, ret_value) = self._graph[self._state, 'clone'] return ret_value def trace(self): (self._state, ret_value) = self._graph[self._state, 'trace'] return ret_value" "def main(): class auto: def __init__(self): self.state = 'A' def copy(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 1 elif self.state == 'C': self.state = 'F' return 4 elif self.state == 'D': self.state = 'E' return 5 elif self.state == 'F': self.state = 'G' return 8 elif self.state == 'G': self.state = 'G' return 9 else: raise KeyError def chip(self): if self.state == 'B': self.state = 'G' return 2 elif self.state == 'C': self.state = 'D' return 3 elif self.state == 'D': self.state = 'G' return 6 elif self.state == 'E': self.state = 'F' return 7 else: raise KeyError return auto()" "class Mealy: def __init__(self): self.A = {'wreck': [0, 'B'], 'erase': [1, 'C']} self.B = {'wreck': [2, 'C']} self.C = {'wreck': [4, 'F'], 'erase': [3, 'D']} self.D = {'wreck': [5, 'E'], 'erase': [6, 'A']} self.E = {'erase': [7, 'F']} self.F = {'wreck': [8, 'G'], 'erase': [9, 'D']} self.G = 'stop' self.link = {'A': self.A, 'B': self.B, 'C': self.C, 'D': self.D, 'E': self.E, 'F': self.F, 'G': self.G} self.current = self.A def wreck(self): temp = None try: temp = self.current['wreck'][0] self.current = self.link[self.current['wreck'][1]] except KeyError: raise else: return temp def erase(self): temp = None try: temp = self.current['erase'][0] self.current = self.link[self.current['erase'][1]] except KeyError: raise else: return temp def main(): return Mealy()" "from abc import ABC, abstractmethod class P(ABC): @abstractmethod def mask(self, current) -> int: pass @abstractmethod def share(self, current) -> int: pass @abstractmethod def paint(self, current) -> int: pass @abstractmethod def post(self, current) -> int: pass class A(P): def mask(self, current) -> int: return 3 def share(self, current) -> int: current.current = C() return 1 def paint(self, current) -> int: current.current = B() return 0 def post(self, current) -> int: current.current = G() return 2 class B(P): def mask(self, current) -> int: current.current = C() return 4 def share(self, current) -> int: raise KeyError() def paint(self, current) -> int: raise KeyError() def post(self, current) -> int: raise KeyError() class C(P): def mask(self, current) -> int: raise KeyError() def share(self, current) -> int: current.current = D() return 5 def paint(self, current) -> int: raise KeyError() def post(self, current) -> int: raise KeyError() class D(P): def mask(self, current) -> int: raise KeyError() def share(self, current) -> int: current.current = E() return 6 def paint(self, current) -> int: raise KeyError() def post(self, current) -> int: raise KeyError() class E(P): def mask(self, current) -> int: raise KeyError() def share(self, current) -> int: raise KeyError() def paint(self, current) -> int: current.current = F() return 7 def post(self, current) -> int: return 8 class F(P): def mask(self, current) -> int: raise KeyError() def share(self, current) -> int: raise KeyError() def paint(self, current) -> int: raise KeyError() def post(self, current) -> int: current.current = G() return 9 class G(P): def mask(self, current) -> int: raise KeyError() def share(self, current) -> int: raise KeyError() def paint(self, current) -> int: raise KeyError() def post(self, current) -> int: raise KeyError() class FiniteStateMachine: def __init__(self) -> None: self.current = A() def mask(self) -> int: return self.current.mask(self) def share(self) -> int: return self.current.share(self) def paint(self) -> int: return self.current.paint(self) def post(self) -> int: return self.current.post(self) def main() -> FiniteStateMachine: return FiniteStateMachine()" "class main: def __init__(self): self.word = 'A' def amble(self): if self.word == 'B': self.word = 'C' return 2 elif self.word == 'E': self.word = 'F' return 5 elif self.word == 'H': self.word = 'H' return 11 elif self.word == 'G': self.word = 'D' return 9 else: raise KeyError() def daub(self): if self.word == 'D': self.word = 'E' return 4 elif self.word == 'G': self.word = 'G' return 8 elif self.word == 'A': self.word = 'D' return 1 else: raise KeyError() def clone(self): if self.word == 'A': self.word = 'B' return 0 elif self.word == 'C': self.word = 'D' return 3 elif self.word == 'F': self.word = 'G' return 6 elif self.word == 'G': self.word = 'H' return 7 elif self.word == 'H': self.word = 'D' return 10 else: raise KeyError()" "class Miles_FSM: def __init__(self): self.state = 'A' def rev(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 3 elif self.state == 'C': self.state = 'D' return 4 elif self.state == 'D': self.state = 'A' return 6 elif self.state == 'G': self.state = 'H' return 9 elif self.state == 'H': self.state = 'C' return 10 else: raise KeyError def skip(self): if self.state == 'A': self.state = 'H' return 1 elif self.state == 'D': self.state = 'E' return 5 elif self.state == 'E': self.state = 'F' return 7 elif self.state == 'F': self.state = 'G' return 8 else: raise KeyError def peep(self): if self.state == 'A': self.state = 'F' return 2 elif self.state == 'H': self.state = 'H' return 11 else: raise KeyError def main(): obj = Miles_FSM() return obj" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def drag(self): return self.update({State.A: [State.B, 0], State.G: [State.A, 8], State.E: [State.F, 5]}) def mute(self): return self.update({State.B: [State.D, 2], State.C: [State.D, 3], State.D: [State.E, 4], State.G: [State.E, 9], State.F: [State.G, 6]}) def scan(self): return self.update({State.F: [State.A, 7], State.B: [State.C, 1]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main: def __init__(self): self.word = 'A' def forge(self): if self.word == 'A': self.word = 'B' return 0 elif self.word == 'B': self.word = 'C' return 2 elif self.word == 'D': self.word = 'E' return 4 elif self.word == 'E': self.word = 'C' return 7 else: raise KeyError() def code(self): if self.word == 'C': self.word = 'D' return 3 elif self.word == 'F': self.word = 'C' return 8 elif self.word == 'A': self.word = 'F' return 1 if self.word == 'E': self.word = 'F' return 5 else: raise KeyError() def check(self): if self.word == 'E': self.word = 'A' return 6 else: raise KeyError()" "class main: def __init__(self): self.word = 'A' def rock(self): if self.word == 'A': self.word = 'B' return 0 elif self.word == 'B': self.word = 'C' return 1 elif self.word == 'C': self.word = 'E' return 4 elif self.word == 'D': self.word = 'E' return 5 elif self.word == 'E': self.word = 'F' return 6 else: raise KeyError() def carve(self): if self.word == 'B': self.word = 'B' return 2 elif self.word == 'C': self.word = 'D' return 3 elif self.word == 'E': self.word = 'E' return 7 elif self.word == 'F': self.word = 'A' return 8 else: raise KeyError()" "class StateMachine: state = 'A' def daub(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 2 elif self.state == 'C': self.state = 'D' return 4 elif self.state == 'D': self.state = 'E' return 6 elif self.state == 'F': self.state = 'G' return 8 elif self.state == 'G': self.state = 'H' return 10 elif self.state == 'H': self.state = 'A' return 11 else: raise KeyError def chalk(self): if self.state == 'A': self.state = 'F' return 1 elif self.state == 'B': self.state = 'E' return 3 elif self.state == 'C': self.state = 'G' return 5 elif self.state == 'E': self.state = 'F' return 7 elif self.state == 'F': self.state = 'B' return 9 else: raise KeyError def main(): return StateMachine()" "class MealyMachine: def __init__(self): self.outputs = {'A': {'drive': (0, 'B')}, 'B': {'drive': (1, 'C')}, 'C': {'order': (2, 'D'), 'drive': (3, 'G')}, 'D': {'drive': (4, 'E'), 'order': (5, 'F')}, 'E': {'order': (6, 'F')}, 'F': {'order': (7, 'G')}, 'G': {'drive': (8, 'B'), 'order': (9, 'G')}} self.current_input = 'A' def move(self, method): number = self.outputs[self.current_input][method][0] self.current_input = self.outputs[self.current_input][method][1] return number def drive(self): return self.move('drive') def order(self): return self.move('order') def main(): return MealyMachine()" "class main: def __init__(self): self.condition = 'A' def amble(self): if self.condition == 'A': self.condition = 'B' return 0 elif self.condition == 'B': self.condition = 'B' return 2 elif self.condition == 'C': self.condition = 'C' return 4 elif self.condition == 'E': self.condition = 'B' return 7 else: raise KeyError def shade(self): if self.condition == 'B': self.condition = 'C' return 1 elif self.condition == 'C': self.condition = 'D' return 3 elif self.condition == 'D': self.condition = 'E' return 5 elif self.condition == 'E': self.condition = 'C' return 8 else: raise KeyError def sweep(self): if self.condition == 'E': self.condition = 'F' return 6 else: raise KeyError" "def main(): return StateMachine() class StateMachine: def __init__(self): self.current_state = 'A' self.states = {'A': ['turn'], 'B': ['leer', 'wreck', 'turn', 'hoard'], 'C': ['hoard'], 'D': ['hoard'], 'E': ['hoard'], 'F': ['leer', 'hoard'], 'G': ['hoard'], 'H': ['leer']} def turn(self): if 'turn' not in self.states[self.current_state]: raise KeyError('Wrong state') if self.current_state == 'A': self.current_state = 'B' return 0 elif self.current_state == 'B': self.current_state = 'E' return 3 def leer(self): if 'leer' not in self.states[self.current_state]: raise KeyError('Wrong state') if self.current_state == 'B': return 4 elif self.current_state == 'F': self.current_state = 'C' return 9 elif self.current_state == 'H': self.current_state = 'B' return 11 def wreck(self): if 'wreck' not in self.states[self.current_state]: raise KeyError('Wrong state') if self.current_state == 'B': self.current_state = 'C' return 1 def hoard(self): if 'hoard' not in self.states[self.current_state]: raise KeyError('Wrong state') if self.current_state == 'B': self.current_state = 'G' return 2 if self.current_state == 'C': self.current_state = 'D' return 5 if self.current_state == 'D': self.current_state = 'E' return 6 if self.current_state == 'E': self.current_state = 'F' return 7 if self.current_state == 'F': self.current_state = 'G' return 8 if self.current_state == 'G': self.current_state = 'H' return 10" "class StateMachine: state = 'A' def shade(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'F' return 3 elif self.state == 'G': self.state = 'A' return 9 else: raise KeyError def skip(self): if self.state == 'B': self.state = 'C' return 1 elif self.state == 'C': self.state = 'D' return 4 elif self.state == 'D': self.state = 'E' return 5 elif self.state == 'E': self.state = 'F' return 6 elif self.state == 'F': self.state = 'G' return 7 else: raise KeyError def hoard(self): if self.state == 'B': self.state = 'G' return 2 elif self.state == 'G': self.state = 'C' return 8 else: raise KeyError def main(): return StateMachine()" "def main(): class P9: state = 'A' def show(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'D': self.state = 'A' return 7 elif self.state == 'E': self.state = 'F' return 8 elif self.state == 'B': self.state = 'F' return 3 else: raise KeyError def sweep(self): if self.state == 'A': self.state = 'F' return 1 elif self.state == 'C': return 5 else: raise KeyError def trim(self): if self.state == 'B': self.state = 'C' return 2 elif self.state == 'C': self.state = 'D' return 4 elif self.state == 'D': self.state = 'E' return 6 else: raise KeyError return P9()" "class main: def __init__(self): self.state = 'A' self.graph = {('A', 'mass'): ('B', 0), ('A', 'peep'): ('F', 1), ('B', 'mass'): ('C', 2), ('B', 'peep'): ('G', 3), ('C', 'mass'): ('D', 4), ('C', 'peep'): ('C', 5), ('D', 'peep'): ('E', 6), ('D', 'mass'): ('F', 7), ('E', 'mass'): ('F', 8), ('F', 'peep'): ('G', 9)} def mass(self): (self.state, ret) = self.graph[self.state, 'mass'] return ret def peep(self): (self.state, ret) = self.graph[self.state, 'peep'] return ret" "class Avtomat: def __init__(self): self.pos = 'A' def melt(self): if self.pos == 'A': self.pos = 'B' return 0 if self.pos == 'B': self.pos = 'F' return 3 if self.pos == 'C': self.pos = 'D' return 4 if self.pos == 'E': self.pos = 'A' return 8 raise KeyError() def chip(self): if self.pos == 'B': self.pos = 'C' return 2 if self.pos == 'D': self.pos = 'E' return 5 if self.pos == 'E': self.pos = 'C' return 7 raise KeyError() def speed(self): if self.pos == 'A': self.pos = 'F' return 1 if self.pos == 'E': self.pos = 'F' return 6 raise KeyError() def main(): return Avtomat()" "def main(): class auto: state = 'A' def scrub(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'C': self.state = 'D' return 2 elif self.state == 'E': self.state = 'F' return 6 else: raise KeyError def hop(self): if self.state == 'B': self.state = 'C' return 1 elif self.state == 'C': return 4 elif self.state == 'D': self.state = 'E' return 5 elif self.state == 'F': self.state = 'G' return 8 else: raise KeyError def edit(self): if self.state == 'C': self.state = 'G' return 3 elif self.state == 'G': self.state = 'D' return 9 elif self.state == 'E': self.state = 'A' return 7 else: raise KeyError return auto()" "class StateMachine: def __init__(self): self.state = 'A' def scan(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 1 elif self.state == 'D': self.state = 'A' return 4 elif self.state == 'E': self.state = 'F' return 5 elif self.state == 'F': self.state = 'D' return 8 else: raise KeyError def trim(self): if self.state == 'C': self.state = 'D' return 2 elif self.state == 'D': self.state = 'E' return 3 elif self.state == 'E': self.state = 'E' return 6 elif self.state == 'F': self.state = 'G' return 7 elif self.state == 'G': self.state = 'B' return 9 else: raise KeyError def main(): obj = StateMachine() return obj" "class StateMachine: state = 'A' def load(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'E' return 3 elif self.state == 'C': self.state = 'D' return 4 elif self.state == 'E': self.state = 'F' return 6 else: raise KeyError def base(self): if self.state == 'B': self.state = 'C' return 1 elif self.state == 'E': self.state = 'C' return 8 else: raise KeyError def march(self): if self.state == 'B': return 2 elif self.state == 'E': self.state = 'A' return 7 elif self.state == 'D': self.state = 'E' return 5 else: raise KeyError def main(): return StateMachine()" "class main: def __init__(self): self.condition = 'A' def drive(self): if self.condition == 'A': self.condition = 'B' return 0 if self.condition == 'C': self.condition = 'D' return 3 if self.condition == 'D': self.condition = 'F' return 6 if self.condition == 'F': self.condition = 'G' return 9 if self.condition == 'E': self.condition = 'E' return 8 raise KeyError def trash(self): if self.condition == 'B': self.condition = 'C' return 2 if self.condition == 'C': self.condition = 'F' return 4 if self.condition == 'D': self.condition = 'E' return 5 if self.condition == 'E': self.condition = 'F' return 7 if self.condition == 'A': self.condition = 'E' return 1 raise KeyError" "class main: def __init__(self): self.state = 'A' def melt(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': return 2 elif self.state == 'C': self.state = 'D' return 3 else: raise KeyError() def base(self): if self.state == 'C': self.state = 'A' return 4 elif self.state == 'B': self.state = 'C' return 1 elif self.state == 'D': self.state = 'B' return 6 elif self.state == 'E': self.state = 'F' return 7 else: raise KeyError() def wreck(self): if self.state == 'E': self.state = 'B' return 8 elif self.state == 'D': self.state = 'E' return 5 else: raise KeyError()" "class Mili: state = -1 def view(self): if self.state == -1: self.state = 0 elif self.state in [0, 6]: self.state = 3 elif self.state == 4: self.state = 6 else: raise KeyError return self.state def stall(self): if self.state in [0, 6]: self.state = 2 elif self.state in [1, 2, 8]: self.state = 4 elif self.state == 4: self.state = 5 elif self.state == 5: self.state = 7 else: raise KeyError return self.state def rush(self): if self.state == -1: self.state = 1 elif self.state == 5: self.state = 8 else: raise KeyError return self.state def main(): return Mili()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class StateMachine: state = State.A def stand(self): return self.update({State.A: [State.B, 0], State.F: [State.F, 8]}) def sway(self): return self.update({State.A: [State.D, 1], State.B: [State.C, 3], State.C: [State.D, 5], State.D: [State.E, 6], State.E: [State.F, 7]}) def init(self): return self.update({State.A: [State.E, 2], State.B: [State.E, 4]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): state_machine = StateMachine() return state_machine" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def model(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 2], State.D: [State.D, 5], State.E: [State.F, 7], State.H: [State.H, 10]}) def race(self): return self.update({State.C: [State.D, 3], State.D: [State.G, 6], State.F: [State.G, 8], State.H: [State.D, 11]}) def jog(self): return self.update({State.A: [State.G, 1], State.D: [State.E, 4], State.G: [State.H, 9]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class Milli: hurry_dict = {'A': ['B', 0], 'B': ['E', 2], 'C': ['D', 3], 'D': ['G', 5], 'E': ['E', 7], 'F': ['G', 8], 'G': []} base_dict = {'B': ['C', 1], 'D': ['E', 4], 'E': ['F', 6], 'F': ['C', 9], 'G': []} def __init__(self): self.state = 'A' def hurry(self): if self.state == 'G': raise KeyError() tmp = self.hurry_dict[self.state][1] self.state = self.hurry_dict[self.state][0] return tmp def base(self): if self.state == 'G': raise KeyError() tmp = self.base_dict[self.state][1] self.state = self.base_dict[self.state][0] return tmp def main(): return Milli()" "class main: a = 0 state = 'A' def exit(self): dict = {'A': [0, 'B'], 'B': KeyError, 'C': [2, 'D'], 'D': [5, 'E'], 'E': KeyError, 'F': KeyError} for (key, value) in dict.items(): if key == self.state: if value == KeyError: raise KeyError else: self.a = value[0] self.state = value[1] return self.a def peek(self): dict = {'A': KeyError, 'B': [1, 'C'], 'C': [4, 'E'], 'D': [7, 'F'], 'E': [8, 'F'], 'F': KeyError} for (key, value) in dict.items(): if key == self.state: if value == KeyError: raise KeyError else: self.a = value[0] self.state = value[1] return self.a def fork(self): dict = {'A': KeyError, 'B': KeyError, 'C': [3, 'C'], 'D': [6, 'B'], 'E': KeyError, 'F': KeyError} for (key, value) in dict.items(): if key == self.state: if value == KeyError: raise KeyError else: self.a = value[0] self.state = value[1] return self.a" "class MilesFSM: def __init__(self): self.state = 'A' def amble(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 3 elif self.state == 'G': self.state = 'B' return 11 else: raise KeyError def group(self): if self.state == 'A': self.state = 'D' return 2 elif self.state == 'C': self.state = 'H' return 5 elif self.state == 'E': self.state = 'F' return 7 elif self.state == 'F': self.state = 'G' return 9 else: raise KeyError def dash(self): if self.state == 'A': self.state = 'H' return 1 elif self.state == 'D': self.state = 'E' return 6 elif self.state == 'G': self.state = 'H' return 10 else: raise KeyError def punch(self): if self.state == 'C': self.state = 'D' return 4 elif self.state == 'E': self.state = 'E' return 8 else: raise KeyError def main(): obj = MilesFSM() return obj" "class FSM: def __init__(self): self.state = 'A' def peep(self): if self.state == 'A': self.state = 'B' return 0 if self.state == 'C': self.state = 'D' return 2 if self.state == 'F': self.state = 'B' return 8 if self.state == 'G': self.state = 'H' return 10 else: raise KeyError def model(self): if self.state == 'B': self.state = 'C' return 1 if self.state == 'D': self.state = 'E' return 4 if self.state == 'E': self.state = 'A' return 6 if self.state == 'F': self.state = 'G' return 7 else: raise KeyError def start(self): if self.state == 'C': self.state = 'H' return 3 if self.state == 'E': self.state = 'F' return 5 if self.state == 'F': self.state = 'H' return 9 if self.state == 'G': self.state = 'D' return 11 else: raise KeyError def main(): sm = FSM() return sm" "def main(): class State: state = 'A' def scrub(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'C': self.state = 'D' return 4 elif self.state == 'D': self.state = 'E' return 6 else: raise KeyError def loop(self): if self.state == 'A': return 1 elif self.state == 'C': self.state = 'E' return 5 else: raise KeyError def spin(self): if self.state == 'A': self.state = 'D' return 2 elif self.state == 'B': self.state = 'C' return 3 elif self.state == 'E': self.state = 'F' return 7 elif self.state == 'F': self.state = 'B' return 8 else: raise KeyError return State()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class StateMachine: state = State.A def roam(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 1], State.D: [State.E, 3], State.E: [State.C, 5], State.F: [State.B, 7], State.G: [State.C, 9]}) def clean(self): return self.update({State.C: [State.D, 2], State.E: [State.F, 4], State.F: [State.G, 6], State.G: [State.G, 8]}) def update(self, Dict): signal = Dict[self.state][1] self.state = Dict[self.state][0] return signal def main(): return StateMachine()" "class main: now_letter = 'A' slov_pull = {'A': 'A1', 'D': 'A6', 'C': 'D4', 'B': 'E3', 'E': 'G8', 'F': 'G9', 'G': 'H10'} slov_edit = {'A': 'B0', 'B': 'C2', 'D': 'E5', 'E': 'F7', 'G': 'B11'} def pull(self): temp_drive = self.now_letter if self.slov_pull.get(temp_drive, 'KeyError')[0] != 'K': self.now_letter = self.slov_pull.get(temp_drive, 'KeyError')[0] return int(self.slov_pull.get(temp_drive)[1:len(self.slov_pull.get(temp_drive, 'KeyError'))]) else: raise KeyError def edit(self): temp_fetch = self.now_letter if self.slov_edit.get(temp_fetch, 'KeyError')[0] != 'K': self.now_letter = self.slov_edit.get(temp_fetch, 'KeyError')[0] return int(self.slov_edit.get(temp_fetch)[1:len(self.slov_pull.get(temp_fetch, 'KeyError'))]) else: raise KeyError" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class StateMachine: state = State.A def update(self, transitons): (self.state, signal) = transitons[self.state] return signal def grow(self): return self.update({State.A: [State.B, 0], State.C: [State.D, 2], State.D: [State.E, 4], State.E: [State.F, 6]}) def paste(self): return self.update({State.B: [State.C, 1], State.C: [State.F, 3], State.D: [State.A, 5], State.E: [State.B, 7], State.F: [State.A, 8]}) def main(): return StateMachine()" "class FSM: def __init__(self): self.A = 'A' self.B = 'B' self.C = 'C' self.D = 'D' self.E = 'E' self.F = 'F' self.G = 'G' self.start = self.A self.current_state = self.start def put(self): if self.current_state == self.A: self.current_state = self.B return 0 elif self.current_state == self.B: self.current_state = self.C return 2 elif self.current_state == self.D: self.current_state = self.E return 5 elif self.current_state == self.E: self.current_state = self.A return 7 else: raise KeyError def forge(self): if self.current_state == self.A: self.current_state = self.F return 1 elif self.current_state == self.B: self.current_state = self.F return 3 elif self.current_state == self.E: self.current_state = self.F return 6 elif self.current_state == self.F: self.current_state = self.G return 8 elif self.current_state == self.G: self.current_state = self.E return 9 elif self.current_state == self.C: self.current_state = self.D return 4 else: raise KeyError def main(): evaluator = FSM() return evaluator" "class MilesFSM: def __init__(self): self.state = 'A' def step(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'C': self.state = 'D' return 3 elif self.state == 'F': self.state = 'B' return 8 else: raise KeyError def order(self): if self.state == 'F': self.state = 'A' return 7 elif self.state == 'G': self.state = 'H' return 9 elif self.state == 'B': self.state = 'G' return 2 elif self.state == 'E': self.state = 'F' return 5 elif self.state == 'D': self.state = 'E' return 4 else: raise KeyError def carve(self): if self.state == 'H': self.state = 'A' return 11 elif self.state == 'F': self.state = 'G' return 6 else: raise KeyError def split(self): if self.state == 'G': self.state = 'D' return 10 elif self.state == 'B': self.state = 'C' return 1 else: raise KeyError def main(): obj = MilesFSM() return obj" "class main: now_letter = 'A' slov_scale = {'A': '0B', 'C': '4C', 'D': '6B', 'F': '8D'} slov_wreck = {'A': '1D', 'B': '2C', 'C': '3D', 'D': '5E', 'E': '7F'} def scale(self): temp_scale = self.now_letter if self.slov_scale.get(temp_scale, 'KeyError')[1] != 'e': self.now_letter = self.slov_scale.get(temp_scale, 'KeyError')[1] return int(self.slov_scale.get(temp_scale)[0]) else: raise KeyError def wreck(self): temp_wreck = self.now_letter if self.slov_wreck.get(temp_wreck, 'KeyError')[1] != 'e': self.now_letter = self.slov_wreck.get(temp_wreck, 'KeyError')[1] return int(self.slov_wreck.get(temp_wreck)[0]) else: raise KeyError" "class main: state = 'A' def move(self): if self.state == 'A': self.state = 'B' return 0 if self.state == 'B': self.state = 'H' return 5 if self.state == 'D': self.state = 'E' return 7 raise KeyError def code(self): if self.state == 'A': self.state = 'F' return 1 if self.state == 'B': self.state = 'B' return 4 if self.state == 'C': self.state = 'D' return 6 if self.state == 'G': self.state = 'H' return 10 if self.state == 'H': self.state = 'E' return 11 raise KeyError def erase(self): if self.state == 'B': self.state = 'C' return 2 if self.state == 'F': self.state = 'G' return 9 raise KeyError def exit(self): if self.state == 'B': self.state = 'E' return 3 if self.state == 'E': self.state = 'F' return 8 raise KeyError" "class main: def __init__(self): self.state = 'A' def slog(self): if self.state == 'A': self.state = 'A' return 1 elif self.state == 'B': self.state = 'C' return 2 elif self.state == 'C': self.state = 'D' return 3 elif self.state == 'E': self.state = 'F' return 5 elif self.state == 'F': self.state = 'A' return 7 else: raise KeyError def stash(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'D': self.state = 'E' return 4 elif self.state == 'E': self.state = 'B' return 6 elif self.state == 'F': self.state = 'F' return 8 else: raise KeyError" "class main: def __init__(self): self.state = 'A' def smash(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 2 elif self.state == 'C': self.state = 'D' return 4 elif self.state == 'D': self.state = 'D' return 6 elif self.state == 'E': self.state = 'F' return 7 elif self.state == 'F': self.state = 'D' return 9 else: raise KeyError def stop(self): if self.state == 'B': self.state = 'D' return 3 elif self.state == 'D': self.state = 'E' return 5 elif self.state == 'A': self.state = 'E' return 1 elif self.state == 'F': self.state = 'G' return 8 else: raise KeyError" "class main: def __init__(self): self.status = 'A' def forge(self): match self.status: case 'A': self.status = 'B' return 0 case 'B': self.status = 'C' return 2 case 'C': self.status = 'E' return 5 case _: raise KeyError def show(self): match self.status: case 'A': self.status = 'E' return 1 case 'B': self.status = 'E' return 3 case 'C': self.status = 'D' return 4 case _: raise KeyError def rev(self): match self.status: case 'C': self.status = 'C' return 6 case 'D': self.status = 'E' return 7 case 'E': self.status = 'F' return 8 case _: raise KeyError" "class main: def __init__(self): self.word = 'A' def load(self): if self.word == 'A': self.word = 'B' return 0 elif self.word == 'B': self.word = 'C' return 1 elif self.word == 'E': self.word = 'A' return 7 elif self.word == 'C': self.word = 'D' return 2 elif self.word == 'D': self.word = 'D' return 5 elif self.word == 'G': self.word = 'H' return 9 else: raise KeyError() def drive(self): if self.word == 'D': self.word = 'A' return 4 elif self.word == 'G': self.word = 'B' return 10 elif self.word == 'F': self.word = 'G' return 8 else: raise KeyError() def build(self): if self.word == 'D': self.word = 'E' return 3 elif self.word == 'E': self.word = 'F' return 6 elif self.word == 'H': self.word = 'H' return 11 else: raise KeyError()" "from abc import ABC, abstractmethod class P(ABC): @abstractmethod def stay(self, current) -> int: pass @abstractmethod def cull(self, current) -> int: pass @abstractmethod def trim(self, current) -> int: pass class A(P): def stay(self, current) -> int: current.current = B() return 0 def cull(self, current) -> int: raise KeyError() def trim(self, current) -> int: raise KeyError() class B(P): def cull(self, current) -> int: current.current = C() return 1 def trim(self, current) -> int: raise KeyError() def stay(self, current) -> int: raise KeyError() class C(P): def stay(self, current) -> int: raise KeyError() def cull(self, current) -> int: current.current = D() return 2 def trim(self, current) -> int: current.current = G() return 3 class D(P): def stay(self, current) -> int: current.current = E() return 4 def trim(self, current) -> int: raise KeyError() def cull(self, current) -> int: raise KeyError() class E(P): def stay(self, current) -> int: current.current = G() return 6 def trim(self, current) -> int: current.current = F() return 5 def cull(self, current) -> int: current.current = B() return 7 class F(P): def stay(self, current) -> int: raise KeyError() def cull(self, current) -> int: current.current = G() return 8 def trim(self, current) -> int: current.current = C() return 9 class G(P): def trim(self, current) -> int: current.current = H() return 10 def stay(self, current) -> int: current.current = D() return 11 def cull(self, current) -> int: raise KeyError() class H(P): def stay(self, current) -> int: raise KeyError() def cull(self, current) -> int: raise KeyError() def trim(self, current) -> int: raise KeyError() class FiniteStateMachine: def __init__(self) -> None: self.current = A() def stay(self) -> int: return self.current.stay(self) def cull(self) -> int: return self.current.cull(self) def trim(self) -> int: return self.current.trim(self) def main() -> FiniteStateMachine: return FiniteStateMachine()" "def main(): State = [0, 1, 2, 3, 4, 5, 6, 7] class main: state = State[0] def paint(self): return self.update({State[0]: [State[0], 1], State[1]: [State[3], 3], State[3]: [State[4], 6], State[4]: [State[5], 7], State[5]: [State[6], 9], State[6]: [State[7], 10]}) def begin(self): return self.update({State[0]: [State[1], 0], State[1]: [State[6], 4], State[4]: [State[6], 8]}) def get(self): return self.update({State[1]: [State[2], 2], State[7]: [State[1], 11], State[2]: [State[3], 5]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal return main()" "class main: def __init__(self): self.condition = 'A' def loop(self): if self.condition == 'A': self.condition = 'B' return 0 elif self.condition == 'B': self.condition = 'C' return 1 elif self.condition == 'D': self.condition = 'E' return 4 elif self.condition == 'F': self.condition = 'F' return 8 else: raise KeyError def check(self): if self.condition == 'B': self.condition = 'B' return 2 elif self.condition == 'C': self.condition = 'D' return 3 elif self.condition == 'E': self.condition = 'F' return 6 elif self.condition == 'F': self.condition = 'A' return 7 elif self.condition == 'D': self.condition = 'A' return 5 else: raise KeyError" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class StateMachine: state = State.A def apply(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 2], State.C: [State.D, 3], State.E: [State.E, 7]}) def throw(self): return self.update({State.A: [State.C, 1], State.D: [State.F, 5], State.F: [State.B, 8]}) def base(self): return self.update({State.D: [State.E, 4], State.E: [State.F, 6]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main: def __init__(self): self.status = 'A' def loop(self): match self.status: case 'A': self.status = 'B' return 0 case 'B': self.status = 'D' return 2 case 'C': self.status = 'A' return 4 case 'D': self.status = 'A' return 6 case 'E': self.status = 'F' return 7 case _: return KeyError def push(self): match self.status: case 'B': self.status = 'C' return 1 case 'C': self.status = 'D' return 3 case 'D': self.status = 'E' return 5 case 'E': self.status = 'E' return 8 case 'F': self.status = 'G' return 9 case _: raise KeyError" "class o: rig_dict = {'A': ['C', 1], 'B': ['H', 3], 'C': ['D', 4], 'D': ['E', 6], 'E': ['F', 8], 'G': ['H', 10], 'H': []} mix_dict = {'A': ['B', 0], 'B': ['C', 2], 'C': ['F', 5], 'D': ['B', 7], 'F': ['G', 9], 'H': ['H', 11]} def __init__(self): self.state = 'A' def rig(self): if self.state == 'H': raise KeyError() x = self.rig_dict[self.state][1] self.state = self.rig_dict[self.state][0] return x def mix(self): x = self.mix_dict[self.state][1] self.state = self.mix_dict[self.state][0] return x def main(): return o()" "class Miles_FSM: def __init__(self): self.state = 'A' def tail(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'D': self.state = 'E' return 6 else: raise KeyError def sweep(self): if self.state == 'A': self.state = 'H' return 1 elif self.state == 'E': self.state = 'A' return 8 elif self.state == 'B': self.state = 'H' return 3 elif self.state == 'G': self.state = 'H' return 11 else: raise KeyError def fade(self): if self.state == 'B': self.state = 'C' return 2 elif self.state == 'C': self.state = 'D' return 4 elif self.state == 'E': self.state = 'F' return 7 elif self.state == 'F': self.state = 'G' return 9 else: raise KeyError def apply(self): if self.state == 'C': self.state = 'F' return 5 elif self.state == 'F': self.state = 'H' return 10 else: raise KeyError def main(): obj = Miles_FSM() return obj" "class main: def __init__(self): self.point = 'A' def stay(self): if self.point == 'A': self.point = 'B' return 0 elif self.point == 'B': self.point = 'C' return 1 elif self.point == 'E': self.point = 'A' return 7 elif self.point == 'G': self.point = 'E' return 11 else: raise KeyError def build(self): if self.point == 'B': return 2 elif self.point == 'C': self.point = 'D' return 3 elif self.point == 'E': self.point = 'B' return 6 elif self.point == 'F': self.point = 'G' return 8 elif self.point == 'G': self.point = 'H' return 9 else: raise KeyError def align(self): if self.point == 'D': self.point = 'E' return 4 elif self.point == 'E': self.point = 'F' return 5 elif self.point == 'G': self.point = 'A' return 10 else: raise KeyError" "class main: def __init__(self): self.status = 'A' def color(self): match self.status: case 'A': self.status = 'B' return 0 case 'B': self.status = 'F' return 3 case 'C': self.status = 'D' return 4 case 'D': self.status = 'E' return 5 case 'F': self.status = 'G' return 9 case _: raise KeyError def stare(self): match self.status: case 'B': self.status = 'C' return 1 case 'E': self.status = 'F' return 7 case 'D': self.status = 'G' return 6 case _: raise KeyError def open(self): match self.status: case 'E': self.status = 'A' return 8 case 'B': self.status = 'E' return 2 case _: raise KeyError" "class main: def __init__(self): self.status = 'A' def stare(self): match self.status: case 'A': self.status = 'B' return 0 case 'B': self.status = 'C' return 1 case 'C': self.status = 'D' return 2 case 'D': self.status = 'E' return 5 case 'F': self.status = 'A' return 8 case _: raise KeyError def stash(self): match self.status: case 'C': self.status = 'A' return 4 case 'D': self.status = 'A' return 6 case _: raise KeyError def split(self): match self.status: case 'C': self.status = 'E' return 3 case 'E': self.status = 'F' return 7 case _: raise KeyError" "class main: def __init__(self): self.state = 'A' def scan(self): if self.state == 'A': self.state = 'B' return 0 if self.state == 'C': self.state = 'E' return 4 if self.state == 'D': self.state = 'E' return 5 else: raise KeyError def amble(self): if self.state == 'A': self.state = 'D' return 1 if self.state == 'F': self.state = 'B' return 8 if self.state == 'H': self.state = 'F' return 10 else: raise KeyError def fetch(self): if self.state == 'B': self.state = 'C' return 2 else: raise KeyError def join(self): if self.state == 'C': self.state = 'D' return 3 if self.state == 'E': self.state = 'F' return 6 if self.state == 'F': self.state = 'G' return 7 if self.state == 'G': self.state = 'H' return 9 if self.state == 'H': self.state = 'B' return 11 else: raise KeyError" "class main: def __init__(self): self.state = 'A' def carve(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'C': self.state = 'E' return 3 elif self.state == 'E': self.state = 'B' return 8 else: raise KeyError() def reset(self): if self.state == 'D': self.state = 'E' return 4 elif self.state == 'E': self.state = 'F' return 6 elif self.state == 'F': self.state = 'G' return 9 else: raise KeyError() def group(self): if self.state == 'B': self.state = 'C' return 1 elif self.state == 'C': self.state = 'D' return 2 elif self.state == 'D': self.state = 'D' return 5 elif self.state == 'E': self.state = 'A' return 7 else: raise KeyError() def main(self): return main()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class StateMachine: state = State.A def walk(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 1], State.D: [State.A, 5], State.E: [State.F, 7]}) def step(self): return self.update({State.B: [State.B, 2], State.D: [State.B, 6]}) def debug(self): return self.update({State.C: [State.D, 3], State.D: [State.E, 4], State.E: [State.B, 8]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): o = StateMachine() return o" "class FSM: states = dict(A=[[0, 'B'], [9, '-'], [9, '-']], B=[[9, '-'], [1, 'C'], [9, '-']], C=[[2, 'D'], [3, 'F'], [9, '-']], D=[[5, 'F'], [6, 'A'], [4, 'E']], E=[[9, '-'], [8, 'A'], [7, 'F']], F=[[9, '-'], [9, '-'], [9, '-']]) def __init__(self): self.state = 'A' def shift(self): if self.states[self.state][0][1] == '-': raise KeyError else: a = self.states[self.state][0][0] self.state = self.states[self.state][0][1] return a def exit(self): if self.states[self.state][1][1] == '-': raise KeyError else: a = self.states[self.state][1][0] self.state = self.states[self.state][1][1] return a def roam(self): if self.states[self.state][2][1] == '-': raise KeyError else: a = self.states[self.state][2][0] self.state = self.states[self.state][2][1] return a def main(): obj = FSM() return obj" "class main: point = 'A' play1 = {'A': '0B', 'B': '2C', 'C': '3D', 'D': '6E'} hoard1 = {'A': '1E', 'C': '5G', 'D': '7A', 'E': '8F'} tread1 = {'C': '4E', 'F': '9G'} def play(self): tmp1 = self.point if self.play1.get(tmp1, 'KeyError')[1] != 'e': self.point = self.play1.get(tmp1, 'KeyError')[1] return int(self.play1.get(tmp1)[0]) else: raise KeyError def hoard(self): tmp2 = self.point if self.hoard1.get(tmp2, 'KeyError')[1] != 'e': self.point = self.hoard1.get(tmp2, 'KeyError')[1] return int(self.hoard1.get(tmp2)[0]) else: raise KeyError def tread(self): tmp3 = self.point if self.tread1.get(tmp3, 'KeyError')[1] != 'e': self.point = self.tread1.get(tmp3, 'KeyError')[1] return int(self.tread1.get(tmp3)[0]) else: raise KeyError" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class main: state = State.A def amass(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 1], State.C: [State.D, 3], State.D: [State.E, 5], State.F: [State.G, 8], State.G: [State.B, 10]}) def rock(self): return self.update({State.B: [State.H, 2], State.G: [State.D, 11], State.E: [State.F, 7], State.D: [State.B, 6], State.C: [State.F, 4]}) def paste(self): return self.update({State.G: [State.H, 9]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal" "class Milie: def __init__(self): self.state = 'A' def make(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'E': self.state = 'C' return 6 elif self.state == 'G': self.state = 'H' return 8 else: raise KeyError def drive(self): if self.state == 'B': self.state = 'C' return 1 elif self.state == 'C': self.state = 'D' return 2 elif self.state == 'D': self.state = 'B' return 4 elif self.state == 'E': self.state = 'F' return 5 elif self.state == 'F': self.state = 'G' return 7 elif self.state == 'G': self.state = 'B' return 9 elif self.state == 'H': self.state = 'A' return 10 else: raise KeyError def tread(self): if self.state == 'D': self.state = 'E' return 3 elif self.state == 'H': self.state = 'B' return 11 else: raise KeyError def main(): obj = Milie() return obj" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class StateMachine: state = State.A def blame(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 1], State.E: [State.F, 6], State.F: [State.F, 9]}) def fill(self): return self.update({State.B: [State.D, 2], State.C: [State.D, 4], State.D: [State.E, 5], State.E: [State.E, 7]}) def tweak(self): return self.update({State.B: [State.E, 3], State.F: [State.G, 8]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main: def __init__(self): start_state = 'A' states = {'A': {'fetch': [0, 'B'], 'slur': [1, 'E'], 'roam': [2, 'C']}, 'B': {'slur': [3, 'C']}, 'C': {'slur': [4, 'D']}, 'D': {'roam': [6, 'B'], 'fetch': [5, 'E']}, 'E': {'fetch': [7, 'F']}, 'F': {'slur': [8, 'G'], 'fetch': [9, 'A']}, 'G': {'fetch': [10, 'H']}, 'H': {'roam': [11, 'E']}} self.state = start_state self.states = states def __getattr__(self, attr): if attr not in self.states[self.state].keys(): raise KeyError self.result = self.states[self.state][attr][0] self.state = self.states[self.state][attr][1] return self.res def res(self): return self.result" "class StateMachine: state = 'A' def glare(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'E' return 3 elif self.state == 'D': self.state = 'E' return 5 elif self.state == 'E': self.state = 'F' return 7 elif self.state == 'F': return 8 else: raise KeyError def play(self): if self.state == 'A': self.state = 'F' return 1 elif self.state == 'B': self.state = 'C' return 2 elif self.state == 'C': self.state = 'D' return 4 elif self.state == 'D': self.state = 'B' return 6 else: raise KeyError def main(): return StateMachine()" "class main: def __init__(self): self.state = 'A' def stash(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 1 elif self.state == 'C': self.state = 'D' return 2 elif self.state == 'E': self.state = 'F' return 5 elif self.state == 'F': self.state = 'A' return 8 else: raise KeyError def snap(self): if self.state == 'D': self.state = 'E' return 4 elif self.state == 'E': self.state = 'B' return 7 else: raise KeyError def move(self): if self.state == 'C': self.state = 'E' return 3 elif self.state == 'E': self.state = 'E' return 6 else: raise KeyError" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class main: state = State.A def log(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 1], State.C: [State.D, 2], State.D: [State.E, 4], State.E: [State.F, 6], State.F: [State.B, 8]}) def race(self): return self.update({State.C: [State.E, 3], State.D: [State.A, 5], State.E: [State.E, 7]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class StateMachine: state = State.A def push(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 2], State.E: [State.F, 5], State.F: [State.B, 8]}) def slip(self): return self.update({State.A: [State.E, 1], State.E: [State.C, 6]}) def crush(self): return self.update({State.C: [State.D, 3], State.D: [State.E, 4], State.E: [State.B, 7]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class main: state = State.A def build(self): return self.update({State.A: [State.B, 0], State.E: [State.G, 6], State.F: [State.F, 8]}) def throw(self): return self.update({State.B: [State.C, 1], State.C: [State.D, 2], State.E: [State.F, 4], State.F: [State.G, 7]}) def rev(self): return self.update({State.E: [State.C, 5], State.D: [State.E, 3], State.F: [State.B, 9]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class main: state = State.A def mass(self): return self.update({State.A: [State.B, 0], State.B: [State.D, 2], State.D: [State.E, 5], State.E: [State.F, 6], State.F: [State.G, 7], State.H: [State.F, 10]}) def check(self): return self.update({State.B: [State.C, 1], State.C: [State.D, 4], State.G: [State.B, 9]}) def amass(self): return self.update({State.B: [State.H, 3], State.G: [State.H, 8], State.H: [State.H, 11]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal" "class main: def __init__(self): self.word = 'A' def fetch(self): if self.word == 'A': self.word = 'B' return 0 elif self.word == 'C': self.word = 'D' return 3 elif self.word == 'E': self.word = 'F' return 6 else: raise KeyError() def fade(self): if self.word == 'A': self.word = 'C' return 1 elif self.word == 'B': self.word = 'C' return 2 elif self.word == 'C': self.word = 'C' return 4 elif self.word == 'D': self.word = 'E' return 5 elif self.word == 'F': self.word = 'C' return 7 else: raise KeyError() def wreck(self): if self.word == 'F': self.word = 'A' return 8 else: raise KeyError()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class main: state = State.A def tag(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 1], State.F: [State.B, 8], State.E: [State.F, 5], State.G: [State.D, 9]}) def hoard(self): return self.update({State.B: [State.D, 2], State.C: [State.D, 3], State.D: [State.E, 4], State.E: [State.G, 6], State.F: [State.G, 7]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal" "class main: def __init__(self): self.condition = 'A' def smash(self): if self.condition == 'A': self.condition = 'B' return 0 elif self.condition == 'B': self.condition = 'C' return 3 elif self.condition == 'E': self.condition = 'F' return 7 elif self.condition == 'F': self.condition = 'G' return 8 else: raise KeyError def mix(self): if self.condition == 'A': self.condition = 'C' return 1 elif self.condition == 'C': self.condition = 'D' return 4 elif self.condition == 'D': self.condition = 'A' return 6 else: raise KeyError def rig(self): if self.condition == 'A': self.condition = 'E' return 2 elif self.condition == 'D': self.condition = 'E' return 5 elif self.condition == 'G': self.condition = 'B' return 9 else: raise KeyError" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class StateMachine: state = State.A def throw(self): return self.update({State.A: [State.B, 0], State.B: [State.G, 3], State.C: [State.D, 4], State.D: [State.E, 5], State.E: [State.F, 6]}) def peep(self): return self.update({State.A: [State.D, 1], State.B: [State.C, 2], State.E: [State.G, 7], State.F: [State.G, 8], State.G: [State.G, 9]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): o = StateMachine() return o" "class main: def __init__(self): self._state = 'A' self._graph = {('A', 'lower'): ('B', 0), ('A', 'color'): ('D', 1), ('B', 'color'): ('C', 2), ('C', 'cut'): ('D', 3), ('D', 'color'): ('E', 4), ('D', 'cut'): ('H', 5), ('E', 'color'): ('F', 6), ('F', 'color'): ('G', 7), ('F', 'lower'): ('H', 8), ('G', 'lower'): ('H', 9), ('G', 'cut'): ('D', 10), ('G', 'color'): ('C', 11)} def lower(self): (self._state, ret) = self._graph[self._state, 'lower'] return ret def color(self): (self._state, ret) = self._graph[self._state, 'color'] return ret def cut(self): (self._state, ret) = self._graph[self._state, 'cut'] return ret" "class StateMachine: state = 'A' def visit(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'C': self.state = 'D' return 2 elif self.state == 'D': self.state = 'E' return 5 else: raise KeyError def color(self): if self.state == 'B': self.state = 'C' return 1 elif self.state == 'D': self.state = 'B' return 6 elif self.state == 'C': self.state = 'F' return 4 elif self.state == 'E': self.state = 'F' return 7 else: raise KeyError def glare(self): if self.state == 'C': self.state = 'E' return 3 elif self.state == 'F': self.state = 'D' return 8 else: raise KeyError def main(): return StateMachine()" "class Milli: def __init__(self, state): self.state = state def amble(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 2 else: raise KeyError def mask(self): if self.state == 'A': self.state = 'C' return 1 elif self.state == 'C': self.state = 'D' return 4 elif self.state == 'D': self.state = 'E' return 5 elif self.state == 'F': self.state = 'G' return 8 else: raise KeyError def stall(self): if self.state == 'B': self.state = 'D' return 3 elif self.state == 'D': self.state = 'A' return 6 elif self.state == 'E': self.state = 'F' return 7 elif self.state == 'G': self.state = 'E' return 9 else: raise KeyError def main(): return Milli('A')" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class main: state = State.A def coat(self): return self.update({State.B: [State.C, 1], State.C: [State.D, 3], State.D: [State.B, 5], State.E: [State.C, 8], State.F: [State.G, 9], State.G: [State.H, 10]}) def grow(self): return self.update({State.A: [State.B, 0], State.B: [State.F, 2], State.D: [State.E, 4], State.E: [State.G, 7], State.H: [State.D, 11]}) def put(self): return self.update({State.E: [State.F, 6]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal" "class main: def __init__(self): self.state = 'A' def click(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'C': self.state = 'D' return 3 elif self.state == 'B': self.state = 'E' return 2 elif self.state == 'E': self.state = 'F' return 6 elif self.state == 'F': self.state = 'G' return 8 else: raise KeyError def post(self): if self.state == 'B': self.state = 'C' return 1 elif self.state == 'C': self.state = 'C' return 4 elif self.state == 'D': self.state = 'E' return 5 elif self.state == 'F': self.state = 'F' return 9 elif self.state == 'E': self.state = 'G' return 7 else: raise KeyError" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class StateMachine: state = State.A def clean(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 1], State.C: [State.A, 4], State.D: [State.E, 5], State.E: [State.F, 6], State.F: [State.A, 8]}) def base(self): return self.update({State.B: [State.D, 2], State.C: [State.D, 3], State.F: [State.D, 7]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): state_machine = StateMachine() return state_machine" "class StateMachine: state = 'A' def play(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 2 elif self.state == 'C': self.state = 'D' return 4 else: raise KeyError def add(self): if self.state == 'A': return 1 elif self.state == 'D': self.state = 'E' return 6 elif self.state == 'E': self.state = 'H' return 8 elif self.state == 'G': self.state = 'H' return 10 else: raise KeyError def skew(self): if self.state == 'B': self.state = 'D' return 3 elif self.state == 'C': self.state = 'H' return 5 elif self.state == 'E': self.state = 'F' return 7 elif self.state == 'F': self.state = 'G' return 9 elif self.state == 'G': self.state = 'C' return 11 else: raise KeyError def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class main: state = State.A def load(self): return self.update({State.A: [State.A, 1], State.C: [State.G, 4], State.D: [State.E, 5], State.E: [State.H, 7], State.F: [State.G, 8], State.G: [State.H, 10]}) def debug(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 2], State.C: [State.D, 3], State.E: [State.F, 6], State.F: [State.H, 9], State.G: [State.D, 11]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal o = main()" "class Mealy: state = 'A' def visit(self): if self.state == 'A': self.state = 'B' return 0 if self.state == 'B': self.state = 'C' return 1 if self.state == 'E': self.state = 'F' return 7 if self.state == 'F': self.state = 'G' return 8 if self.state == 'H': self.state = 'C' return 11 raise KeyError def log(self): if self.state == 'B': self.state = 'E' return 2 if self.state == 'C': self.state = 'D' return 4 if self.state == 'G': self.state = 'C' return 10 raise KeyError def sit(self): if self.state == 'B': self.state = 'D' return 3 if self.state == 'C': self.state = 'F' return 5 if self.state == 'D': self.state = 'E' return 6 if self.state == 'G': self.state = 'H' return 9 raise KeyError def main(): o = Mealy() return o" "class Mili: def __init__(self): self.pos = 'A' self.value = 0 def load(self): if self.pos == 'A': self.pos = 'B' self.value = 0 elif self.pos == 'C': self.pos = 'D' self.value = 4 elif self.pos == 'D': self.pos = 'E' self.value = 5 elif self.pos == 'B': self.pos = 'F' self.value = 3 elif self.pos == 'F': self.pos = 'G' self.value = 8 else: raise KeyError return self.value def scale(self): if self.pos == 'B': self.pos = 'C' self.value = 1 elif self.pos == 'D': self.pos = 'F' self.value = 6 elif self.pos == 'F': self.pos = 'F' self.value = 9 else: raise KeyError return self.value def flip(self): if self.pos == 'E': self.pos = 'F' self.value = 7 elif self.pos == 'B': self.pos = 'E' self.value = 2 else: raise KeyError return self.value def main(): return Mili()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class StateMachine: state = State.A def etch(self): return self.update({State.A: [State.B, 0], State.C: [State.C, 3], State.D: [State.D, 6]}) def align(self): return self.update({State.B: [State.C, 1], State.D: [State.E, 4], State.E: [State.C, 8]}) def tread(self): return self.update({State.C: [State.D, 2], State.D: [State.B, 5], State.E: [State.F, 7]}) def update(self, Dict): signal = Dict[self.state][1] self.state = Dict[self.state][0] return signal def main(): return StateMachine()" "class main: def __init__(self): self.__state = 'A' def pan(self): if self.__state == 'A': self.__state = 'B' return 0 if self.__state == 'C': self.__state = 'C' return 4 if self.__state == 'D': self.__state = 'E' return 5 if self.__state == 'E': self.__state = 'F' return 6 if self.__state == 'F': self.__state = 'G' return 7 if self.__state == 'G': self.__state = 'E' return 8 raise KeyError def edit(self): if self.__state == 'A': self.__state = 'E' return 1 if self.__state == 'B': self.__state = 'C' return 2 if self.__state == 'C': self.__state = 'D' return 3 if self.__state == 'G': self.__state = 'D' return 9 raise KeyError" "class main: def __init__(self): self.status = 'A' def model(self): match self.status: case 'A': self.status = 'B' return 0 case 'D': self.status = 'D' return 7 case 'E': self.status = 'F' return 8 case 'F': self.status = 'G' return 9 case _: raise KeyError def grow(self): match self.status: case 'B': self.status = 'C' return 4 case 'C': self.status = 'D' return 5 case 'A': self.status = 'G' return 1 case _: raise KeyError def hop(self): match self.status: case 'A': self.status = 'A' return 2 case 'D': self.status = 'E' return 6 case _: raise KeyError def unite(self): match self.status: case 'A': self.status = 'F' return 3 case _: raise KeyError" "class main: def __init__(self): self.status = 'A' def flip(self): match self.status: case 'A': self.status = 'B' return 0 case 'B': self.status = 'F' return 3 case 'E': self.status = 'F' return 6 case 'F': self.status = 'A' return 8 case _: raise KeyError def shade(self): match self.status: case 'A': self.status = 'D' return 1 case 'B': self.status = 'C' return 2 case 'C': self.status = 'D' return 4 case 'D': self.status = 'E' return 5 case 'E': self.status = 'E' return 7 case _: raise KeyError" "class milly: state = 'A' def __init__(self): state = 'A' def scale(self): if milly.state == 'A': milly.state = 'B' return 0 if milly.state == 'B': milly.state = 'C' return 2 if milly.state == 'C': milly.state = 'D' return 4 if milly.state == 'D': milly.state = 'B' return 6 if milly.state == 'E': milly.state = 'B' return 8 raise KeyError def blame(self): if milly.state == 'A': milly.state = 'F' return 1 if milly.state == 'B': milly.state = 'B' return 3 if milly.state == 'D': milly.state = 'E' return 5 if milly.state == 'E': milly.state = 'F' return 7 raise KeyError def main(): return milly()" "class milly: state = 'A' def __init__(self): state = 'A' def chat(self): if milly.state == 'A': milly.state = 'F' return 2 if milly.state == 'E': milly.state = 'F' return 7 raise KeyError def chain(self): if milly.state == 'D': milly.state = 'A' return 6 if milly.state == 'A': milly.state = 'E' return 1 if milly.state == 'B': milly.state = 'C' return 3 raise KeyError def drag(self): if milly.state == 'A': milly.state = 'B' return 0 if milly.state == 'D': milly.state = 'E' return 5 if milly.state == 'C': milly.state = 'D' return 4 if milly.state == 'F': milly.state = 'B' return 8 raise KeyError def main(): return milly()" "class main: def __init__(self): self.state = 'A' def rock(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'E' return 2 elif self.state == 'C': self.state = 'E' return 4 elif self.state == 'D': self.state = 'E' return 5 elif self.state == 'F': self.state = 'G' return 7 elif self.state == 'G': self.state = 'G' return 9 else: raise KeyError() def chain(self): if self.state == 'B': self.state = 'C' return 1 elif self.state == 'C': self.state = 'D' return 3 elif self.state == 'E': self.state = 'F' return 6 elif self.state == 'F': self.state = 'C' return 8 else: raise KeyError" "class main(object): state = 'A' def __init__(self): pass def link(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'C': self.state = 'D' return 3 elif self.state == 'D': self.state = 'F' return 7 else: raise KeyError def glare(self): if self.state == 'B': self.state = 'C' return 2 elif self.state == 'C': self.state = 'C' return 5 elif self.state == 'D': self.state = 'E' return 6 elif self.state == 'E': self.state = 'F' return 8 else: raise KeyError def spawn(self): if self.state == 'C': self.state = 'E' return 4 elif self.state == 'A': self.state = 'F' return 1 else: raise KeyError" "class main(object): state = 'A' def __init__(self): pass def split(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'D': self.state = 'E' return 4 elif self.state == 'E': self.state = 'F' return 6 else: raise KeyError def debug(self): if self.state == 'B': self.state = 'C' return 2 elif self.state == 'F': self.state = 'C' return 10 elif self.state == 'E': self.state = 'G' return 8 elif self.state == 'D': self.state = 'H' return 5 else: raise KeyError def send(self): if self.state == 'C': self.state = 'D' return 3 elif self.state == 'G': self.state = 'H' return 11 else: raise KeyError def march(self): if self.state == 'E': self.state = 'C' return 7 elif self.state == 'F': self.state = 'G' return 9 elif self.state == 'A': self.state = 'G' return 1 else: raise KeyError" "class A: state = 'A' def hurry(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'C': self.state = 'G' return 4 elif self.state == 'D': self.state = 'D' return 6 elif self.state == 'E': self.state = 'F' return 7 elif self.state == 'F': self.state = 'G' return 8 elif self.state == 'G': self.state = 'B' return 9 else: raise KeyError def group(self): if self.state == 'B': self.state = 'C' return 1 elif self.state == 'C': self.state = 'D' return 2 elif self.state == 'D': self.state = 'E' return 5 else: raise KeyError def open(self): if self.state == 'C': self.state = 'F' return 3 else: raise KeyError def main(): return A()" "from abc import ABC, abstractmethod class P(ABC): @abstractmethod def stop(self, current) -> int: pass @abstractmethod def rush(self, current) -> int: pass @abstractmethod def throw(self, current) -> int: pass class A(P): def stop(self, current) -> int: current.current = A() return 1 def rush(self, current) -> int: current.current = B() return 0 def throw(self, current) -> int: raise KeyError() class B(P): def stop(self, current) -> int: current.current = F() return 3 def rush(self, current) -> int: current.current = D() return 4 def throw(self, current) -> int: current.current = C() return 2 class C(P): def stop(self, current) -> int: raise KeyError() def rush(self, current) -> int: raise KeyError() def throw(self, current) -> int: current.current = D() return 5 class D(P): def stop(self, current) -> int: current.current = E() return 6 def rush(self, current) -> int: raise KeyError() def throw(self, current) -> int: raise KeyError() class E(P): def stop(self, current) -> int: current.current = F() return 7 def rush(self, current) -> int: raise KeyError() def throw(self, current) -> int: raise KeyError() class F(P): def stop(self, current) -> int: raise KeyError() def rush(self, current) -> int: current.current = A() return 8 def throw(self, current) -> int: raise KeyError() class FiniteStateMachine: def __init__(self) -> None: self.current = A() def stop(self) -> int: return self.current.stop(self) def rush(self) -> int: return self.current.rush(self) def throw(self) -> int: return self.current.throw(self) def main() -> FiniteStateMachine: return FiniteStateMachine()" "import re class main: now_letter = 'A' slov_crash = {'A': '2A', 'B': '3C', 'C': '6D', 'D': '7E'} slov_put = {'A': '0B', 'B': '5E', 'F': '9G'} slov_tread = {'A': '1C', 'B': '4G', 'E': '8F'} def crash(self): temp_crash = self.now_letter num = '' letter = '' if self.slov_crash.get(temp_crash, 'KeyError')[1] != 'e': let = re.findall('\\D', self.slov_crash.get(temp_crash, 'KeyError')) for e in let: letter += str(e) self.now_letter = letter number = re.findall('\\d', self.slov_crash.get(temp_crash)) for e in number: num += str(e) return int(num) else: raise KeyError def put(self): temp_put = self.now_letter num = '' letter = '' if self.slov_put.get(temp_put, 'KeyError')[1] != 'e': let = re.findall('\\D', self.slov_put.get(temp_put, 'KeyError')) for e in let: letter += str(e) self.now_letter = letter number = re.findall('\\d', self.slov_put.get(temp_put)) for e in number: num += str(e) return int(num) else: raise KeyError def tread(self): temp_tread = self.now_letter num = '' letter = '' if self.slov_tread.get(temp_tread, 'KeyError')[1] != 'e': let = re.findall('\\D', self.slov_tread.get(temp_tread, 'KeyError')) for e in let: letter += str(e) self.now_letter = letter number = re.findall('\\d', self.slov_tread.get(temp_tread)) for e in number: num += str(e) return int(num) else: raise KeyError" "class main: def __init__(self): self.state = 'A' self.path = {'A': [[self.tweak, 0, 'B'], [self.skew, 1, 'E']], 'B': [[self.skew, 2, 'C']], 'C': [[self.skew, 4, 'A'], [self.tweak, 3, 'D']], 'D': [[self.sway, 5, 'E']], 'E': [[self.skew, 7, 'B'], [self.sway, 6, 'F']], 'F': [[self.skew, 8, 'F']]} def tweak(self): return self.check(self.tweak) def skew(self): return self.check(self.skew) def sway(self): return self.check(self.sway) def check(self, func): elem = [function for function in self.path[self.state] if func == function[0]] if len(elem) != 0: self.state = elem[0][2] return elem[0][1] else: raise KeyError" "class main: def __init__(self): self.n = 'A' def chain(self): if self.n == 'A': self.n = 'B' return 0 if self.n == 'B': self.n = 'C' return 2 if self.n == 'C': self.n = 'D' return 4 if self.n == 'D': self.n = 'E' return 5 else: raise KeyError def hurry(self): if self.n == 'A': self.n = 'C' return 1 if self.n == 'B': self.n = 'B' return 3 if self.n == 'D': self.n = 'G' return 6 if self.n == 'E': self.n = 'F' return 7 if self.n == 'F': self.n = 'G' return 8 if self.n == 'G': self.n = 'C' return 9 else: raise KeyError" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class StateMachine: state = State.A def peep(self): return self.update({State.A: [State.B, 0]}) def rig(self): return self.update({State.A: [State.D, 1], State.B: [State.C, 3], State.C: [State.D, 4], State.F: [State.C, 7]}) def stop(self): return self.update({State.A: [State.E, 2], State.D: [State.E, 5], State.E: [State.F, 6], State.F: [State.B, 8]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class Mili: state = 'A' def spawn(self): map = {'A': ('B', 0), 'B': ('B', 2), 'C': ('F', 4), 'E': ('F', 6), 'F': ('G', 8)} result = map[self.state][1] self.state = map[self.state][0] return result def click(self): map = {'B': ('C', 1), 'C': ('D', 3), 'D': ('E', 5), 'E': ('B', 7), 'G': ('B', 9)} result = map[self.state][1] self.state = map[self.state][0] return result def main(): return Mili()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class StateMachine: state = State.A def link(self): return self.update({State.A: [State.A, 2], State.B: [State.C, 3], State.C: [State.D, 4], State.F: [State.G, 8]}) def split(self): return self.update({State.A: [State.B, 0], State.D: [State.F, 6], State.E: [State.F, 7], State.F: [State.F, 9]}) def scan(self): return self.update({State.A: [State.C, 1], State.D: [State.E, 5]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class StateMachine: state = State.A def send(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 1], State.C: [State.D, 2], State.D: [State.B, 6], State.F: [State.G, 8]}) def stall(self): return self.update({State.C: [State.F, 4], State.F: [State.D, 9]}) def hop(self): return self.update({State.C: [State.G, 3], State.D: [State.E, 5], State.E: [State.F, 7]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class FSM: def __init__(self): self.current_state = 'a' def scrub(self): if self.current_state == 'a': self.current_state = 'b' return 0 elif self.current_state == 'f': self.current_state = 'b' return 7 elif self.current_state == 'd': self.current_state = 'e' return 4 else: raise KeyError def send(self): if self.current_state == 'a': self.current_state = 'e' return 1 elif self.current_state == 'b': self.current_state = 'c' return 2 elif self.current_state == 'e': self.current_state = 'f' return 5 elif self.current_state == 'f': self.current_state = 'd' return 8 else: raise KeyError def stand(self): if self.current_state == 'c': self.current_state = 'd' return 3 elif self.current_state == 'f': self.current_state = 'c' return 6 else: raise KeyError def main(): return FSM()" "class Mill: state = -1 def reset(self): if self.state in [-1, 6]: self.state = 0 elif self.state == 4: self.state = 7 elif self.state in [3, 8]: self.state = 9 else: raise KeyError return self.state def glare(self): if self.state in [0, 11]: self.state = 2 elif self.state == 4: self.state = 6 else: raise KeyError return self.state def scale(self): if self.state in [7, 9]: self.state = 11 elif self.state in [-1, 6]: self.state = 1 elif self.state == 2: self.state = 4 elif self.state == 4: self.state = 5 else: raise KeyError return self.state def drag(self): if self.state in [0, 11]: self.state = 3 elif self.state in [1, 5]: self.state = 8 elif self.state in [7, 9]: self.state = 10 else: raise KeyError return self.state def main(): return Mill()" "from enum import Enum, auto class State(Enum): A = auto() B = auto() C = auto() D = auto() E = auto() F = auto() G = auto() def main(): return Main() class Main: def __init__(self) -> None: self.state = State.A def speed(self): match self.state: case State.A: raise KeyError() case State.B: self.state = State.C return 1 case State.C: self.state = State.F return 4 case State.D: self.state = State.E return 6 case State.E: self.state = State.F return 7 case State.F: self.state = State.G return 8 case State.G: raise KeyError() def scan(self): match self.state: case State.A: raise KeyError() case State.B: self.state = State.F return 2 case State.C: self.state = State.C return 5 case State.D: raise KeyError() case State.E: raise KeyError() case State.F: raise KeyError() case State.G: self.state = State.B return 9 def stop(self): match self.state: case State.A: self.state = State.B return 0 case State.C: self.state = State.D return 3 case State.B: raise KeyError() case _: raise KeyError() o = main()" "class Miles: def __init__(self): self._state = 'A' self._graph = {('A', 'chalk'): ('B', 0), ('A', 'leer'): ('C', 1), ('B', 'chalk'): ('C', 2), ('B', 'leer'): ('G', 3), ('C', 'chalk'): ('D', 4), ('C', 'leer'): ('F', 5), ('D', 'leer'): ('E', 6), ('E', 'leer'): ('F', 7), ('F', 'chalk'): ('G', 8), ('G', 'chalk'): ('A', 9)} def chalk(self): (self._state, ret_value) = self._graph[self._state, 'chalk'] return ret_value def leer(self): (self._state, ret_value) = self._graph[self._state, 'leer'] return ret_value def main(): return Miles() o = main()" "class main: def __init__(self): self.state = 'A' def punch(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'H': self.state = 'A' return 11 else: raise KeyError def rock(self): if self.state == 'B': self.state = 'C' return 2 elif self.state == 'E': self.state = 'F' return 7 elif self.state == 'A': self.state = 'F' return 1 else: raise KeyError def visit(self): if self.state == 'C': self.state = 'D' return 4 elif self.state == 'D': self.state = 'E' return 6 elif self.state == 'B': self.state = 'G' return 3 elif self.state == 'G': self.state = 'A' return 10 else: raise KeyError def log(self): if self.state == 'G': self.state = 'H' return 9 elif self.state == 'F': self.state = 'G' return 8 elif self.state == 'C': self.state = 'H' return 5 else: raise KeyError" "class main(object): def __init__(self): self.id = 'A' def cull(self): match self.id: case 'A': self.id = 'B' return 0 case 'D': self.id = 'G' return 5 case 'E': self.id = 'G' return 8 case 'B': self.id = 'H' return 2 raise KeyError def debug(self): match self.id: case 'B': self.id = 'C' return 1 case 'C': self.id = 'D' return 3 case 'D': self.id = 'E' return 4 case 'E': return 7 case 'F': self.id = 'G' return 9 case 'G': self.id = 'H' return 10 case 'H': self.id = 'C' return 11 raise KeyError def begin(self): match self.id: case 'E': self.id = 'F' return 6 raise KeyError" "class main: def __init__(self): self.word = 'A' def build(self): if self.word == 'A': self.word = 'C' return 1 elif self.word == 'B': self.word = 'E' return 3 elif self.word == 'E': self.word = 'F' return 6 elif self.word == 'G': self.word = 'B' return 9 else: raise KeyError() def send(self): if self.word == 'A': self.word = 'B' return 0 elif self.word == 'B': self.word = 'C' return 2 elif self.word == 'C': self.word = 'D' return 4 elif self.word == 'D': self.word = 'E' return 5 elif self.word == 'E': self.word = 'E' return 7 elif self.word == 'F': self.word = 'G' return 8 else: raise KeyError()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def stop(self): return self.update({State.A: [State.A, 1], State.B: [State.C, 4], State.G: [State.D, 11]}) def slip(self): return self.update({State.A: [State.B, 0], State.D: [State.E, 6], State.E: [State.F, 7]}) def hike(self): return self.update({State.A: [State.C, 2], State.C: [State.D, 5]}) def punch(self): return self.update({State.A: [State.D, 3], State.E: [State.E, 8], State.F: [State.G, 9], State.G: [State.H, 10]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def hop(self): return self.update({State.A: [State.B, 0], State.E: [State.F, 7], State.F: [State.G, 10]}) def sit(self): return self.update({State.B: [State.C, 3], State.A: [State.G, 2], State.E: [State.G, 8], State.C: [State.D, 4], State.D: [State.F, 6]}) def visit(self): return self.update({State.A: [State.H, 1], State.D: [State.E, 5], State.E: [State.C, 9], State.G: [State.H, 11]}) def update(self, transitions): try: (self.state, signal) = transitions[self.state] return signal except KeyError: raise KeyError def main(): obj = StateMachine() return obj" "class main: def __init__(self): self.status = 'A' def clean(self): match self.status: case 'A': self.status = 'B' return 0 case 'E': self.status = 'E' return 7 case 'F': self.status = 'H' return 9 case 'G': self.status = 'H' return 11 case _: raise KeyError def spawn(self): match self.status: case 'A': self.status = 'C' return 1 case 'B': self.status = 'F' return 3 case 'D': self.status = 'E' return 5 case 'E': self.status = 'F' return 6 case 'F': self.status = 'G' return 8 case _: raise KeyError def tag(self): match self.status: case 'B': self.status = 'C' return 2 case 'C': self.status = 'D' return 4 case 'F': self.status = 'F' return 10 case _: raise KeyError" "class main: def __init__(self): self.condition = 'A' def bolt(self): if self.condition == 'A': self.condition = 'B' return 0 elif self.condition == 'B': self.condition = 'C' return 3 elif self.condition == 'C': self.condition = 'D' return 5 elif self.condition == 'D': self.condition = 'E' return 6 elif self.condition == 'E': self.condition = 'F' return 8 else: raise KeyError def trace(self): if self.condition == 'A': self.condition = 'B' return 2 elif self.condition == 'B': self.condition = 'D' return 4 else: raise KeyError def cast(self): if self.condition == 'A': self.condition = 'D' return 1 elif self.condition == 'D': self.condition = 'F' return 7 elif self.condition == 'F': self.condition = 'G' return 9 else: raise KeyError" "class StateMachine: state = 'A' def hop(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'D' return 2 elif self.state == 'C': self.state = 'D' return 3 elif self.state == 'E': self.state = 'A' return 6 elif self.state == 'F': self.state = 'G' return 7 elif self.state == 'G': self.state = 'A' return 9 else: raise KeyError def flip(self): if self.state == 'B': self.state = 'C' return 1 elif self.state == 'D': self.state = 'E' return 4 elif self.state == 'E': self.state = 'F' return 5 elif self.state == 'G': self.state = 'B' return 8 else: raise KeyError def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def send(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 1], State.E: [State.B, 5], State.F: [State.G, 6], State.G: [State.D, 9]}) def lower(self): return self.update({State.C: [State.D, 2], State.G: [State.B, 7]}) def patch(self): return self.update({State.D: [State.E, 3], State.E: [State.F, 4], State.G: [State.G, 8]}) def update(self, transitions): try: (self.state, signal) = transitions[self.state] return signal except KeyError: raise KeyError def main(): obj = StateMachine() return obj" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class StateMachine: state = State.A def stall(self): return self.update({State.A: [State.B, 0], State.D: [State.D, 5], State.E: [State.A, 7]}) def scrub(self): return self.update({State.A: [State.C, 1], State.E: [State.F, 6]}) def coat(self): return self.update({State.B: [State.C, 2], State.C: [State.D, 3], State.D: [State.E, 4], State.F: [State.D, 8]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main: def __init__(self): self.__state = 'A' def bend(self): if self.__state == 'A': return 1 if self.__state == 'F': self.__state = 'D' return 8 if self.__state == 'E': self.__state = 'B' return 7 raise KeyError def chain(self): if self.__state == 'A': self.__state = 'B' return 0 if self.__state == 'B': return 3 if self.__state == 'D': self.__state = 'E' return 5 raise KeyError def share(self): if self.__state == 'B': self.__state = 'C' return 2 if self.__state == 'C': self.__state = 'D' return 4 if self.__state == 'E': self.__state = 'F' return 6 raise KeyError" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class StateMachine: state = State.A def sit(self): return self.update({State.A: [State.B, 0], State.C: [State.D, 3], State.E: [State.F, 6], State.G: [State.G, 9]}) def paint(self): return self.update({State.A: [State.D, 1], State.B: [State.C, 2], State.D: [State.E, 5], State.C: [State.C, 4], State.F: [State.G, 7], State.G: [State.D, 8]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class Mile: current_state = 'A' def paint(self): if self.current_state == 'A': self.current_state = 'B' return 0 elif self.current_state == 'D': self.current_state = 'E' return 4 elif self.current_state == 'E': self.current_state = 'F' return 5 elif self.current_state == 'F': self.current_state = 'A' return 8 else: raise KeyError def place(self): if self.current_state == 'B': self.current_state = 'C' return 2 elif self.current_state == 'C': self.current_state = 'D' return 3 elif self.current_state == 'A': self.current_state = 'E' return 1 elif self.current_state == 'E': self.current_state = 'E' return 6 elif self.current_state == 'F': self.current_state = 'D' return 7 else: raise KeyError def main(): o = Mile() return o" "class Milly: state: str def __init__(self): self.state = 'A' def drag(self): if self.state == 'A': self.state = 'B' return 0 if self.state == 'B': self.state = 'C' return 2 if self.state == 'C': self.state = 'D' return 3 if self.state == 'D': self.state = 'E' return 5 if self.state == 'F': return 8 raise KeyError def sort(self): if self.state == 'A': self.state = 'C' return 1 if self.state == 'C': self.state = 'F' return 4 if self.state == 'E': self.state = 'B' return 7 raise KeyError def etch(self): if self.state == 'E': self.state = 'F' return 6 raise KeyError def main(): return Milly()" "class main: def __init__(self): self.state = 'A' def tweak(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'F': self.state = 'G' return 8 else: raise KeyError() def chat(self): if self.state == 'A': self.state = 'C' return 2 elif self.state == 'B': self.state = 'B' return 4 elif self.state == 'C': self.state = 'D' return 5 elif self.state == 'D': self.state = 'E' return 6 else: raise KeyError() def show(self): if self.state == 'A': self.state = 'E' return 1 elif self.state == 'B': self.state = 'C' return 3 elif self.state == 'F': self.state = 'D' return 9 elif self.state == 'E': self.state = 'F' return 7 else: raise KeyError() def main(self): return main()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class StateMachine: state = State.A def cull(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 2], State.C: [State.D, 4]}) def brake(self): return self.update({State.A: [State.F, 1], State.B: [State.B, 3], State.C: [State.E, 5], State.D: [State.E, 6], State.E: [State.F, 7], State.F: [State.F, 8]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main: state = 'A' def stare(self): return self.changeover({'A': ['B', 0], 'B': ['C', 1], 'E': ['G', 7], 'G': ['H', 9]}) def color(self): return self.changeover({'B': ['B', 2], 'C': ['D', 4], 'E': ['F', 6], 'F': ['G', 8], 'H': ['D', 11]}) def slip(self): return self.changeover({'B': ['D', 3], 'D': ['E', 5], 'G': ['D', 10]}) def changeover(self, transitions): output = transitions[self.state][1] self.state = transitions[self.state][0] return output" "class main: state = 'A' def scan(self): return self.changeover({'A': ['B', 0], 'C': ['D', 3], 'E': ['F', 8]}) def crash(self): return self.changeover({'B': ['C', 2], 'C': ['E', 4], 'D': ['D', 7]}) def stall(self): return self.changeover({'C': ['A', 5], 'D': ['E', 6], 'A': ['E', 1]}) def changeover(self, transitions): output = transitions[self.state][1] self.state = transitions[self.state][0] return output" "class FSM: def __init__(self): self.A = 'A' self.B = 'B' self.C = 'C' self.D = 'D' self.E = 'E' self.F = 'F' self.start = self.A self.current_state = self.start def smash(self): if self.current_state == self.A: self.current_state = self.B return 0 elif self.current_state == self.B: self.current_state = self.C return 2 elif self.current_state == self.C: self.current_state = self.D return 4 elif self.current_state == self.D: self.current_state = self.E return 5 elif self.current_state == self.E: self.current_state = self.F return 6 elif self.current_state == self.F: self.current_state = self.B return 8 else: raise KeyError def rock(self): if self.current_state == self.A: self.current_state = self.A return 1 elif self.current_state == self.B: self.current_state = self.E return 3 elif self.current_state == self.F: self.current_state = self.C return 7 else: raise KeyError def main(): evaluator = FSM() return evaluator" "class A: state = 'A' def click(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'E' return 2 elif self.state == 'D': self.state = 'E' return 4 else: raise KeyError def close(self): if self.state == 'B': self.state = 'C' return 1 elif self.state == 'C': self.state = 'D' return 3 elif self.state == 'D': self.state = 'B' return 6 elif self.state == 'E': self.state = 'F' return 7 else: raise KeyError def smash(self): if self.state == 'D': self.state = 'A' return 5 if self.state == 'F': self.state = 'D' return 8 else: raise KeyError def main(): return A()" "class MillyMachine: def __init__(self): self.status = 'A' def init(self): if self.status == 'A': self.status = 'B' return 0 if self.status == 'B': self.status = 'C' return 2 if self.status == 'D': self.status = 'E' return 5 raise KeyError def crack(self): if self.status == 'A': self.status = 'A' return 1 if self.status == 'B': self.status = 'D' return 3 if self.status == 'C': self.status = 'D' return 4 if self.status == 'F': self.status = 'D' return 7 if self.status == 'E': self.status = 'F' return 6 raise KeyError def walk(self): if self.status == 'F': self.status = 'B' return 8 raise KeyError def main() -> MillyMachine(): return MillyMachine()" "class Node: dash_l = None snap_l = None scrub_l = None dash_val = None snap_val = None scrub_val = None class Link: node = None def __init__(self, node): self.node = node def dash(self): if self.node.dash_l is None: raise KeyError value = self.node.dash_val self.node = self.node.dash_l return value def snap(self): if self.node.snap_l is None: raise KeyError value = self.node.snap_val self.node = self.node.snap_l return value def scrub(self): if self.node.scrub_l is None: raise KeyError value = self.node.scrub_val self.node = self.node.scrub_l return value def main(): root = Node() root.dash_val = 1 root.dash_l = root root.snap_val = 0 root.snap_l = Node() last = root.snap_l last.dash_val = 3 last.dash_l = Node() last = last.dash_l last.scrub_val = 4 last.scrub_l = Node() last = last.scrub_l root.scrub_val = 2 root.scrub_l = Node() last.snap_val = 6 last.snap_l = last last.dash_val = 5 last.dash_l = Node() last = last.dash_l curr = last last.dash_val = 7 last.dash_l = Node() last = last.dash_l last.scrub_val = 9 last.scrub_l = Node() last = last.scrub_l curr.scrub_val = 8 curr.scrub_l = last return Link(root)" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def group(self): return self.update({State.A: [State.C, 1], State.B: [State.C, 2], State.E: [State.B, 6], State.G: [State.E, 9], State.F: [State.G, 7], State.H: [State.F, 10]}) def slog(self): return self.update({State.A: [State.B, 0], State.C: [State.D, 3], State.D: [State.E, 4], State.E: [State.F, 5], State.G: [State.H, 8], State.H: [State.H, 11]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): o = StateMachine() return o" "class main: now_letter = 'A' slov_reset = {'A': '0B', 'C': '2D', 'D': '4B', 'E': '7E'} slov_herd = {'B': '1C', 'D': '3E', 'E': '6F', 'F': '8G'} slov_model = {'D': '5F', 'G': '9A'} def reset(self): temp_reset = self.now_letter if self.slov_reset.get(temp_reset, 'KeyError')[1] != 'e': self.now_letter = self.slov_reset.get(temp_reset, 'KeyError')[1] return int(self.slov_reset.get(temp_reset)[0]) else: raise KeyError def herd(self): temp_herd = self.now_letter if self.slov_herd.get(temp_herd, 'KeyError')[1] != 'e': self.now_letter = self.slov_herd.get(temp_herd, 'KeyError')[1] return int(self.slov_herd.get(temp_herd)[0]) else: raise KeyError def model(self): temp_model = self.now_letter if self.slov_model.get(temp_model, 'KeyError')[1] != 'e': self.now_letter = self.slov_model.get(temp_model, 'KeyError')[1] return int(self.slov_model.get(temp_model)[0]) else: raise KeyError" "class main: def __init__(self): self.d = {'A': {'B': 0, ' ': None, ' ': None}, 'B': {'C': 1, ' ': None, ' ': None}, 'C': {' ': None, 'C': 3, 'D': 2}, 'D': {' ': None, 'E': 4, ' ': None}, 'E': {'F': 5, 'E': 7, 'C': 6}, 'F': {' ': None, ' ': None, 'D': 8}} self.char = 'A' self.num = 0 def crash(self): for (key, value) in self.d.get(self.char).items(): if isinstance(value, int): self.char = key self.num = value else: raise KeyError break return self.num def glare(self): i = 0 for (key, value) in self.d.get(self.char).items(): if i == 1: if isinstance(value, int): self.char = key self.num = value else: raise KeyError break i += 1 return self.num def apply(self): i = 0 for (key, value) in self.d.get(self.char).items(): if i == 2: if isinstance(value, int): self.char = key self.num = value else: raise KeyError break i += 1 return self.num" "class main: now_letter = 'A' slov_step = {'D': '4B', 'E': '7E', 'F': '8A'} slov_march = {'B': '1C', 'C': '2D', 'E': '6C'} slov_amass = {'A': '0B', 'D': '3E', 'E': '5F'} def step(self): temp_step = self.now_letter if self.slov_step.get(temp_step, 'KeyError')[1] != 'e': self.now_letter = self.slov_step.get(temp_step, 'KeyError')[1] return int(self.slov_step.get(temp_step)[0]) else: raise KeyError def march(self): temp_march = self.now_letter if self.slov_march.get(temp_march, 'KeyError')[1] != 'e': self.now_letter = self.slov_march.get(temp_march, 'KeyError')[1] return int(self.slov_march.get(temp_march)[0]) else: raise KeyError def amass(self): temp_amass = self.now_letter if self.slov_amass.get(temp_amass, 'KeyError')[1] != 'e': self.now_letter = self.slov_amass.get(temp_amass, 'KeyError')[1] return int(self.slov_amass.get(temp_amass)[0]) else: raise KeyError" "class FSM: states = dict(A=[[0, 'B'], [1, 'D'], [2, 'G']], B=[[3, 'C'], [10, '-'], [10, '-']], C=[[10, '-'], [10, '-'], [4, 'D']], D=[[10, '-'], [5, 'E'], [6, 'G']], E=[[7, 'F'], [10, '-'], [8, 'C']], F=[[9, 'G'], [10, '-'], [10, '-']], G=[[10, '-'], [10, '-'], [10, '-']]) def __init__(self): self.state = 'A' def hoard(self): if self.states[self.state][0][1] == '-': raise KeyError else: a = self.states[self.state][0][0] self.state = self.states[self.state][0][1] return a def erase(self): if self.states[self.state][1][1] == '-': raise KeyError else: a = self.states[self.state][1][0] self.state = self.states[self.state][1][1] return a def stay(self): if self.states[self.state][2][1] == '-': raise KeyError else: a = self.states[self.state][2][0] self.state = self.states[self.state][2][1] return a def main(): obj = FSM() return obj" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class StateMachine: state = State.A def close(self): return self.update({State.A: [State.B, 0], State.C: [State.D, 2], State.D: [State.E, 4], State.E: [State.E, 7], State.F: [State.G, 8]}) def hike(self): return self.update({State.B: [State.C, 1], State.C: [State.G, 3], State.D: [State.A, 5], State.E: [State.F, 6], State.F: [State.D, 9]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main: now_letter = 'A' slov_stay = {'A': '0B', 'C': '2D', 'D': '3E', 'E': '6A', 'F': '9G'} slov_share = {'B': '1C', 'E': '5F'} slov_make = {'E': '8C', 'D': '4F'} slov_place = {'E': '7E'} def stay(self): temp_stay = self.now_letter if self.slov_stay.get(temp_stay, 'KeyError')[1] != 'e': self.now_letter = self.slov_stay.get(temp_stay, 'KeyError')[1] return int(self.slov_stay.get(temp_stay)[0]) else: raise KeyError def share(self): temp_share = self.now_letter if self.slov_share.get(temp_share, 'KeyError')[1] != 'e': self.now_letter = self.slov_share.get(temp_share, 'KeyError')[1] return int(self.slov_share.get(temp_share)[0]) else: raise KeyError def make(self): temp_make = self.now_letter if self.slov_make.get(temp_make, 'KeyError')[1] != 'e': self.now_letter = self.slov_make.get(temp_make, 'KeyError')[1] return int(self.slov_make.get(temp_make)[0]) else: raise KeyError def place(self): temp_place = self.now_letter if self.slov_place.get(temp_place, 'KeyError')[1] != 'e': self.now_letter = self.slov_place.get(temp_place, 'KeyError')[1] return int(self.slov_place.get(temp_place)[0]) else: raise KeyError" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class main: state = State.A def paint(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 1], State.D: [State.E, 3], State.F: [State.G, 5], State.G: [State.C, 9]}) def forge(self): return self.update({State.C: [State.D, 2], State.F: [State.F, 6]}) def rush(self): return self.update({State.E: [State.F, 4], State.F: [State.D, 7], State.G: [State.A, 8]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal" "class StateMachine: state = 'A' def coast(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 2 else: raise KeyError def carve(self): if self.state == 'A': self.state = 'D' return 1 elif self.state == 'D': return 5 elif self.state == 'E': self.state = 'F' return 6 elif self.state == 'F': return 8 else: raise KeyError def shift(self): if self.state == 'C': self.state = 'D' return 3 elif self.state == 'D': self.state = 'E' return 4 elif self.state == 'F': self.state = 'D' return 7 else: raise KeyError def main(): return StateMachine()" "class main: def __init__(self): self.state = 'A' self.graph = {('A', 'hurry'): ('B', 0), ('C', 'hurry'): ('D', 3), ('F', 'hurry'): ('G', 7), ('G', 'hurry'): ('H', 8), ('E', 'send'): ('F', 5), ('G', 'send'): ('B', 11), ('B', 'skip'): ('C', 2), ('G', 'skip'): ('A', 9), ('A', 'color'): ('D', 1), ('D', 'color'): ('E', 4), ('G', 'color'): ('E', 10), ('E', 'color'): ('B', 6), ('F', 'color'): ('B', 8)} def hurry(self): (self.state, ret) = self.graph[self.state, 'hurry'] return ret def skip(self): (self.state, ret) = self.graph[self.state, 'skip'] return ret def color(self): (self.state, ret) = self.graph[self.state, 'color'] return ret def send(self): (self.state, ret) = self.graph[self.state, 'send'] return ret" "class M: def __init__(self): self.state = 'A' def skip(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'C': self.state = 'D' return 4 elif self.state == 'D': self.state = 'H' return 7 elif self.state == 'F': self.state = 'G' return 9 elif self.state == 'G': self.state = 'H' return 10 else: raise KeyError def cull(self): if self.state == 'A': self.state = 'D' return 1 elif self.state == 'C': self.state = 'A' return 5 elif self.state == 'G': self.state = 'A' return 11 elif self.state == 'E': self.state = 'F' return 8 else: raise KeyError def model(self): if self.state == 'B': self.state = 'C' return 3 elif self.state == 'A': self.state = 'E' return 2 elif self.state == 'D': self.state = 'E' return 6 else: raise KeyError def main(): obj = M() return obj" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class StateMachine: state = State.A def jog(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 1], State.C: [State.D, 3], State.D: [State.F, 5], State.E: [State.B, 8]}) def speed(self): return self.update({State.B: [State.B, 2], State.D: [State.E, 4], State.E: [State.E, 7]}) def join(self): return self.update({State.E: [State.F, 6]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main: def __init__(self): self.state = 'A' self.graph = {('A', 'stash'): ('B', 0), ('A', 'play'): ('F', 1), ('B', 'march'): ('C', 2), ('C', 'march'): ('C', 4), ('C', 'stash'): ('D', 3), ('D', 'march'): ('E', 5), ('E', 'march'): ('F', 6), ('F', 'play'): ('G', 7), ('G', 'march'): ('G', 8), ('G', 'stash'): ('C', 9)} def stash(self): (self.state, ret) = self.graph[self.state, 'stash'] return ret def play(self): (self.state, ret) = self.graph[self.state, 'play'] return ret def march(self): (self.state, ret) = self.graph[self.state, 'march'] return ret" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class main: state = State.A def get(self): return self.update({State.A: [State.B, 0], State.E: [State.F, 7], State.D: [State.G, 6]}) def bend(self): return self.update({State.A: [State.C, 1], State.B: [State.C, 2], State.C: [State.D, 4], State.D: [State.E, 5], State.E: [State.C, 8]}) def unite(self): return self.update({State.B: [State.F, 3], State.F: [State.G, 9]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class StateMachine: state = State.A def jog(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 1], State.F: [State.C, 8]}) def chain(self): return self.update({State.B: [State.F, 2], State.C: [State.D, 3], State.D: [State.E, 5], State.E: [State.F, 6], State.F: [State.G, 7]}) def slur(self): return self.update({State.C: [State.E, 4], State.F: [State.F, 9]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def amble(self): return self.update({State.D: [State.E, 7], State.A: [State.H, 3], State.G: [State.H, 10]}) def punch(self): return self.update({State.A: [State.A, 1], State.B: [State.E, 5]}) def draw(self): return self.update({State.A: [State.B, 0], State.C: [State.D, 6], State.H: [State.H, 11]}) def play(self): return self.update({State.B: [State.C, 4], State.A: [State.F, 2], State.E: [State.F, 8], State.F: [State.G, 9]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main: def __init__(self): self._cur_state = 'A' def scale(self): if self._cur_state == 'A': self._cur_state = 'B' return 0 if self._cur_state == 'B': self._cur_state = 'C' return 2 if self._cur_state == 'E': self._cur_state = 'C' return 7 if self._cur_state == 'F': self._cur_state = 'G' return 8 if self._cur_state == 'H': self._cur_state = 'D' return 11 raise KeyError() def debug(self): if self._cur_state == 'A': self._cur_state = 'H' return 1 if self._cur_state == 'B': self._cur_state = 'G' return 3 if self._cur_state == 'C': self._cur_state = 'D' return 4 if self._cur_state == 'D': self._cur_state = 'E' return 5 if self._cur_state == 'E': self._cur_state = 'F' return 6 if self._cur_state == 'F': self._cur_state = 'B' return 9 if self._cur_state == 'G': self._cur_state = 'H' return 10 raise KeyError()" "class main: def __init__(self): self.condition = 'A' def place(self): if self.condition == 'A': self.condition = 'B' return 0 elif self.condition == 'C': self.condition = 'D' return 3 elif self.condition == 'D': self.condition = 'E' return 4 elif self.condition == 'E': self.condition = 'F' return 7 elif self.condition == 'F': self.condition = 'G' return 9 else: raise KeyError def snap(self): if self.condition == 'A': self.condition = 'D' return 1 elif self.condition == 'D': self.condition = 'D' return 5 elif self.condition == 'E': self.condition = 'A' return 8 else: raise KeyError def sway(self): if self.condition == 'B': self.condition = 'C' return 2 elif self.condition == 'D': self.condition = 'G' return 6 else: raise KeyError" "def main(): return mils() class mils: def __init__(self): self.state = 'A' def turn(self): match self.state: case 'A': self.state = 'B' return 0 case 'B': self.state = 'C' return 3 case 'C': self.state = 'D' return 6 case 'E': self.state = 'F' return 8 case 'H': self.state = 'D' return 11 case _: raise KeyError() def rig(self): match self.state: case 'A': self.state = 'F' return 8 case 'B': self.state = 'E' return 5 case 'D': self.state = 'E' return 7 case _: raise KeyError() def apply(self): match self.state: case 'A': self.state = 'G' return 2 case 'F': self.state = 'G' return 9 case 'B': self.state = 'h' return 4 case _: raise KeyError() def melt(self): match self.state: case 'G': self.state = 'H' return 10 case _: raise KeyError()" "class main: def __init__(self): self.word = 'A' def amble(self): if self.word == 'A': self.word = 'B' return 0 elif self.word == 'C': self.word = 'D' return 3 elif self.word == 'D': self.word = 'E' return 4 elif self.word == 'G': self.word = 'E' return 10 else: raise KeyError() def run(self): if self.word == 'B': self.word = 'C' return 1 elif self.word == 'D': self.word = 'H' return 6 elif self.word == 'E': self.word = 'F' return 7 elif self.word == 'F': self.word = 'G' return 8 elif self.word == 'G': self.word = 'H' return 9 else: raise KeyError() def visit(self): if self.word == 'D': self.word = 'A' return 5 elif self.word == 'B': self.word = 'H' return 2 elif self.word == 'G': self.word = 'G' return 11 else: raise KeyError()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class StateMachine: state = State.A def color(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 1], State.D: [State.E, 5], State.E: [State.E, 7], State.F: [State.G, 8]}) def skew(self): return self.update({State.B: [State.B, 2], State.C: [State.A, 4]}) def herd(self): return self.update({State.C: [State.D, 3], State.E: [State.F, 6], State.F: [State.F, 9]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main: name = 'A' def throw(self): if self.name == 'A': self.name = 'B' return 0 elif self.name == 'B': self.name = 'C' return 1 elif self.name == 'D': self.name = 'E' return 4 elif self.name == 'G': self.name = 'E' return 8 else: raise KeyError def leer(self): if self.name == 'B': self.name = 'E' return 2 elif self.name == 'C': self.name = 'D' return 3 elif self.name == 'D': self.name = 'A' return 5 elif self.name == 'E': self.name = 'F' return 6 elif self.name == 'F': self.name = 'G' return 7 elif self.name == 'G': self.name = 'D' return 9 else: raise KeyError" "class main: def __init__(self): self._state = 'A' self._graph = {('A', 'patch'): ('A', 2), ('A', 'lower'): ('B', 0), ('A', 'build'): ('D', 1), ('B', 'build'): ('C', 3), ('C', 'build'): ('D', 4), ('C', 'patch'): ('H', 5), ('D', 'patch'): ('E', 6), ('E', 'build'): ('F', 8), ('F', 'lower'): ('G', 9), ('G', 'patch'): ('H', 10), ('D', 'lower'): ('H', 7), ('H', 'build'): ('A', 11)} def patch(self): if self._graph.__contains__((self._state, 'patch')): (self._state, ret) = self._graph[self._state, 'patch'] return ret else: raise KeyError def lower(self): if self._graph.__contains__((self._state, 'lower')): (self._state, ret) = self._graph[self._state, 'lower'] return ret else: raise KeyError def build(self): if self._graph.__contains__((self._state, 'build')): (self._state, ret) = self._graph[self._state, 'build'] return ret else: raise KeyError" "class StateMachine: state = 'A' def pan(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'D': self.state = 'E' return 4 elif self.state == 'E': self.state = 'F' return 5 elif self.state == 'F': self.state = 'G' return 8 else: raise KeyError def color(self): if self.state == 'B': self.state = 'C' return 1 elif self.state == 'F': self.state = 'C' return 10 elif self.state == 'E': self.state = 'H' return 7 else: raise KeyError def chip(self): if self.state == 'B': self.state = 'D' return 2 elif self.state == 'C': self.state = 'D' return 3 elif self.state == 'E': self.state = 'C' return 6 elif self.state == 'G': self.state = 'H' return 11 elif self.state == 'F': self.state = 'B' return 9 else: raise KeyError def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class main: state = State.A def hike(self): return self.update({State.A: [State.B, 0], State.C: [State.E, 4], State.D: [State.E, 6]}) def tread(self): return self.update({State.B: [State.C, 2], State.C: [State.C, 5], State.D: [State.B, 7]}) def put(self): return self.update({State.C: [State.D, 3], State.A: [State.F, 1], State.E: [State.F, 8]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal" "class mili: def __init__(self): self.states = {'A': [('B', 0), ''], 'B': [('C', 1), ''], 'C': [('D', 2), ('G', 3)], 'D': [('E', 4), ('F', 5)], 'E': [('F', 6), ('C', 7)], 'F': [('G', 8), ''], 'G': ['', ('D', 9)]} self.state = 'A' self.num = 0 def slip(self): state1 = self.states[self.state][1] if isinstance(state1, str): raise KeyError else: self.state = state1[0] return state1[1] def chat(self): state1 = self.states[self.state][0] if isinstance(state1, str): raise KeyError else: self.state = state1[0] return state1[1] def main(): return mili()" "class main: def __init__(self): self.state = 'A' self.graph = {('A', 'file'): ('B', 0), ('A', 'glare'): ('E', 1), ('B', 'file'): ('C', 2), ('C', 'throw'): ('D', 3), ('C', 'glare'): ('F', 4), ('D', 'glare'): ('E', 5), ('E', 'file'): ('F', 6), ('E', 'glare'): ('E', 7), ('E', 'throw'): ('B', 8), ('F', 'throw'): ('G', 9)} def file(self): (self.state, ret) = self.graph[self.state, 'file'] return ret def throw(self): (self.state, ret) = self.graph[self.state, 'throw'] return ret def glare(self): (self.state, ret) = self.graph[self.state, 'glare'] return ret" "class Miles_FSM: def __init__(self): self.state = 'A' def peep(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'D': self.state = 'E' return 3 elif self.state == 'E': self.state = 'F' return 5 elif self.state == 'F': self.state = 'H' return 8 elif self.state == 'G': self.state = 'H' return 9 else: raise KeyError def show(self): if self.state == 'B': self.state = 'C' return 1 elif self.state == 'H': self.state = 'A' return 11 elif self.state == 'F': self.state = 'D' return 7 elif self.state == 'B': self.state = 'C' return 1 else: raise KeyError def slog(self): if self.state == 'D': self.state = 'A' return 4 elif self.state == 'C': self.state = 'D' return 2 elif self.state == 'G': self.state = 'D' return 10 elif self.state == 'F': self.state = 'G' return 6 else: raise KeyError def main(): obj = Miles_FSM() return obj" "class StateMachine: state = 'A' def carve(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'C': self.state = 'D' return 3 elif self.state == 'D': self.state = 'E' return 5 elif self.state == 'F': self.state = 'G' return 8 else: raise KeyError def slip(self): if self.state == 'A': self.state = 'F' return 1 elif self.state == 'B': self.state = 'C' return 2 elif self.state == 'D': self.state = 'A' return 6 elif self.state == 'F': self.state = 'C' return 9 elif self.state == 'E': self.state = 'F' return 7 else: raise KeyError def jog(self): if self.state == 'C': return 4 else: raise KeyError def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class main: state = State.A def smash(self): return self.update({State.A: [State.B, 0], State.D: [State.E, 4], State.F: [State.C, 8]}) def slog(self): return self.update({State.A: [State.E, 1], State.B: [State.C, 2], State.E: [State.F, 6]}) def tread(self): return self.update({State.C: [State.D, 3], State.D: [State.A, 5], State.E: [State.C, 7]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class main: state = State.A def crash(self): return self.update({State.A: [State.B, 0], State.C: [State.D, 2], State.E: [State.F, 4], State.F: [State.A, 8], State.H: [State.A, 11]}) def trim(self): return self.update({State.F: [State.D, 7], State.B: [State.C, 1], State.G: [State.H, 9]}) def tread(self): return self.update({State.D: [State.E, 3], State.E: [State.A, 5], State.G: [State.D, 10], State.F: [State.G, 6]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal" "class main: def __init__(self): self.curr_state = 'A' def align(self): if self.curr_state in ['B', 'D', 'F', 'E']: if self.curr_state == 'B': self.curr_state = 'D' return 3 if self.curr_state == 'D': self.curr_state = 'F' return 6 if self.curr_state == 'F': self.curr_state = 'G' return 9 if self.curr_state == 'E': self.curr_state = 'F' return 8 else: raise KeyError('KeyError') def lower(self): if self.curr_state in ['A', 'B', 'C', 'D']: if self.curr_state == 'A': self.curr_state = 'B' return 0 if self.curr_state == 'B': self.curr_state = 'C' return 1 if self.curr_state == 'C': self.curr_state = 'D' return 4 if self.curr_state == 'D': self.curr_state = 'E' return 5 else: raise KeyError('KeyError') def rock(self): if self.curr_state == 'B': self.curr_state = 'G' return 2 else: raise KeyError('KeyError')" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def paint(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 3], State.D: [State.E, 6]}) def step(self): return self.update({State.A: [State.G, 1], State.H: [State.C, 5], State.D: [State.B, 7], State.E: [State.F, 8], State.G: [State.H, 10]}) def stop(self): return self.update({State.A: [State.D, 2], State.C: [State.D, 4], State.F: [State.G, 9], State.G: [State.G, 11]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def join(self): return self.update({State.A: [State.B, 0], State.C: [State.D, 2], State.D: [State.E, 3], State.E: [State.E, 5], State.F: [State.A, 8]}) def jog(self): return self.update({State.B: [State.C, 1], State.E: [State.F, 4]}) def peep(self): return self.update({State.E: [State.B, 6], State.F: [State.F, 7]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main(object): states = ['a', 'b', 'c', 'd', 'e', 'f'] def __init__(self): self.state = 'a' def crush(self): if self.state == 'a': self.state = 'd' return 1 if self.state == 'b': self.state = 'c' return 3 if self.state == 'c': self.state = 'd' return 4 if self.state == 'd': self.state = 'd' return 7 if self.state == 'e': self.state = 'f' return 8 else: raise KeyError def visit(self): if self.state == 'a': self.state = 'b' return 0 else: raise KeyError def spawn(self): if self.state == 'a': self.state = 'e' return 2 if self.state == 'c': self.state = 'e' return 5 if self.state == 'd': self.state = 'e' return 6 else: raise KeyError" "class main: def __init__(self): self.condition = 'A' def shift(self): if self.condition == 'A': self.condition = 'B' return 0 elif self.condition == 'C': self.condition = 'D' return 2 elif self.condition == 'D': self.condition = 'G' return 4 elif self.condition == 'E': self.condition = 'F' return 6 elif self.condition == 'F': self.condition = 'F' return 8 else: raise KeyError def copy(self): if self.condition == 'B': self.condition = 'C' return 1 elif self.condition == 'D': self.condition = 'E' return 3 elif self.condition == 'F': self.condition = 'G' return 7 else: raise KeyError def etch(self): if self.condition == 'D': self.condition = 'A' return 5 elif self.condition == 'F': self.condition = 'D' return 9 else: raise KeyError" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class main: state = State.A def speed(self): return self.update({State.A: [State.B, 0], State.B: [State.E, 2], State.C: [State.C, 4], State.D: [State.E, 5], State.E: [State.F, 7], State.F: [State.C, 8]}) def make(self): return self.update({State.B: [State.C, 1], State.C: [State.D, 3], State.D: [State.F, 6]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class main: state = State.A def dash(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 2], State.C: [State.A, 5], State.F: [State.A, 8]}) def skip(self): return self.update({State.B: [State.D, 3], State.A: [State.D, 1], State.E: [State.F, 7]}) def group(self): return self.update({State.C: [State.D, 4], State.D: [State.E, 6]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal" "class main: def __init__(self): self.__state = 'A' def clone(self): if self.__state == 'B': self.__state = 'C' return 1 if self.__state == 'C': self.__state = 'D' return 3 if self.__state == 'D': self.__state = 'E' return 4 if self.__state == 'E': self.__state = 'B' return 7 if self.__state == 'F': self.__state = 'G' return 8 raise KeyError def brake(self): if self.__state == 'A': self.__state = 'B' return 0 if self.__state == 'B': self.__state = 'B' return 2 if self.__state == 'D': self.__state = 'D' return 5 if self.__state == 'E': self.__state = 'F' return 6 if self.__state == 'F': self.__state = 'B' return 9 raise KeyError" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def scrub(self): return self.update({State.A: [State.B, 0], State.C: [State.D, 3], State.D: [State.E, 4], State.E: [State.F, 5], State.G: [State.H, 8]}) def clean(self): return self.update({State.B: [State.C, 2], State.E: [State.C, 6], State.F: [State.G, 7], State.G: [State.G, 9]}) def type(self): return self.update({State.A: [State.H, 1], State.G: [State.C, 10], State.H: [State.D, 11]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class FSM: def __init__(self): self.A = 'A' self.B = 'B' self.C = 'C' self.D = 'D' self.E = 'E' self.F = 'F' self.G = 'G' self.start = self.A self.current_state = self.start def mask(self): if self.current_state == self.A: self.current_state = self.B return 0 elif self.current_state == self.B: self.current_state = self.C return 1 elif self.current_state == self.C: self.current_state = self.A return 3 elif self.current_state == self.F: self.current_state = self.B return 7 elif self.current_state == self.G: self.current_state = self.B return 9 else: raise KeyError def loop(self): if self.current_state == self.C: self.current_state = self.D return 2 elif self.current_state == self.D: self.current_state = self.E return 4 elif self.current_state == self.E: self.current_state = self.F return 5 elif self.current_state == self.F: self.current_state = self.G return 6 elif self.current_state == self.G: self.current_state = self.A return 8 else: raise KeyError def main(): evaluator = FSM() return evaluator" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class StateMachine: state = State.A def log(self): return self.update({State.A: [State.B, 0], State.B: [State.F, 3], State.C: [State.D, 4], State.D: [State.F, 6], State.E: [State.F, 8]}) def erase(self): return self.update({State.A: [State.D, 1], State.B: [State.C, 2], State.D: [State.E, 5]}) def cull(self): return self.update({State.D: [State.D, 7]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def rev(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 2], State.C: [State.G, 5], State.D: [State.E, 6], State.E: [State.F, 7], State.F: [State.G, 9], State.G: [State.H, 10]}) def group(self): return self.update({State.A: [State.F, 1], State.B: [State.F, 3], State.C: [State.D, 4], State.E: [State.G, 8], State.G: [State.B, 11]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class SomeClass: def __init__(self): self.state = 'A' def daub(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'D': self.state = 'D' return 5 elif self.state == 'E': self.state = 'E' return 7 else: raise KeyError(self.state) def march(self): if self.state == 'B': self.state = 'C' return 1 elif self.state == 'C': self.state = 'D' return 2 elif self.state == 'D': self.state = 'E' return 3 elif self.state == 'E': self.state = 'F' return 6 elif self.state == 'F': self.state = 'C' return 8 else: raise KeyError(self.state) def chip(self): if self.state == 'D': self.state = 'F' return 4 else: raise KeyError(self.state) def main(): return SomeClass()" "class SomeClass: def __init__(self): self.state = 'A' def fork(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 1 elif self.state == 'C': self.state = 'D' return 3 elif self.state == 'E': self.state = 'F' return 7 elif self.state == 'F': self.state = 'F' return 8 else: raise KeyError(self.state) def snap(self): if self.state == 'B': self.state = 'F' return 2 elif self.state == 'C': self.state = 'C' return 4 elif self.state == 'D': self.state = 'B' return 6 else: raise KeyError(self.state) def smash(self): if self.state == 'D': self.state = 'E' return 5 else: raise KeyError(self.state) def main(): return SomeClass()" "class Mily: current_statement = 'A' num_change = None def boost(self): if self.current_statement == 'A': self.num_change = 0 self.current_statement = 'B' elif self.current_statement == 'C': self.num_change = 2 self.current_statement = 'D' elif self.current_statement == 'D': self.num_change = 3 self.current_statement = 'E' elif self.current_statement == 'F': self.num_change = 6 self.current_statement = 'G' elif self.current_statement == 'G': self.num_change = 8 self.current_statement = 'C' else: raise KeyError return self.num_change def show(self): if self.current_statement == 'B': self.num_change = 1 self.current_statement = 'C' elif self.current_statement == 'D': self.num_change = 4 self.current_statement = 'A' elif self.current_statement == 'E': self.num_change = 5 self.current_statement = 'F' elif self.current_statement == 'F': self.num_change = 7 self.current_statement = 'D' elif self.current_statement == 'G': self.num_change = 9 self.current_statement = 'D' else: raise KeyError return self.num_change def main(): m = Mily() return m" "class mili: state = 1 def __init__(self): self.state = 1 def crush(self): if self.state == 1: self.state = 2 return 0 elif self.state == 2: self.state = 6 return 3 elif self.state == 4: self.state = 6 return 7 else: raise KeyError def cast(self): if self.state == 2: self.state = 3 return 2 elif self.state == 4: self.state = 5 return 5 elif self.state == 5: self.state = 6 return 8 else: raise KeyError def join(self): if self.state == 1: self.state = 5 return 1 elif self.state == 3: self.state = 4 return 4 elif self.state == 4: self.state = 4 return 6 else: raise KeyError def main(): o = mili() return o" "class A: state = 'A' def scan(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'C': self.state = 'D' return 2 elif self.state == 'D': self.state = 'H' return 5 elif self.state == 'E': self.state = 'F' return 6 elif self.state == 'G': self.state = 'H' return 9 else: raise KeyError def add(self): if self.state == 'B': self.state = 'C' return 1 elif self.state == 'C': return 3 else: raise KeyError def erase(self): if self.state == 'D': self.state = 'E' return 4 elif self.state == 'G': return 10 else: raise KeyError def amass(self): if self.state == 'E': self.state = 'C' return 7 if self.state == 'F': self.state = 'G' return 8 if self.state == 'H': self.state = 'B' return 11 else: raise KeyError def main(): return A()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def push(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 1], State.C: [State.D, 3], State.D: [State.E, 6]}) def crawl(self): return self.update({State.C: [State.E, 4], State.E: [State.F, 8], State.F: [State.G, 9]}) def peek(self): return self.update({State.B: [State.H, 2], State.D: [State.D, 7], State.C: [State.H, 5], State.F: [State.C, 10], State.G: [State.H, 11]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class StateMachine: state = State.A def dash(self): return self.update({State.A: [State.A, 1], State.C: [State.C, 5], State.D: [State.E, 6], State.E: [State.F, 7], State.B: [State.F, 3]}) def init(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 2], State.C: [State.D, 4], State.F: [State.G, 8], State.G: [State.G, 9]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine() '/n'" "class Milli: def __init__(self): self.curr_state = 'a' def melt(self): state = self.curr_state if state == 'a': self.curr_state = 'b' return 0 if state == 'b': self.curr_state = 'c' return 2 if state == 'c': self.curr_state = 'd' return 3 if state == 'd': self.curr_state = 'e' return 5 if state == 'e': self.curr_state = 'f' return 7 raise KeyError def daub(self): state = self.curr_state if state == 'a': self.curr_state = 'g' return 1 if state == 'c': self.curr_state = 'e' return 4 if state == 'd': self.curr_state = 'g' return 6 if state == 'e': self.curr_state = 'b' return 8 if state == 'f': self.curr_state = 'g' return 9 raise KeyError def main(): return Milli()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: def __init__(self): self.state = State.A def herd(self): if self.state == State.A: self.state = State.B return 0 elif self.state == State.B: self.state = State.C return 1 elif self.state == State.C: self.state = State.A return 5 elif self.state == State.D: self.state = State.E return 6 elif self.state == State.F: self.state = State.G return 8 elif self.state == State.H: self.state = State.D return 11 else: raise KeyError def bend(self): if self.state == State.B: return 2 elif self.state == State.C: self.state = State.G return 4 elif self.state == State.E: self.state = State.F return 7 elif self.state == State.G: self.state = State.H return 9 else: raise KeyError def step(self): if self.state == State.C: self.state = State.D return 3 elif self.state == State.H: self.state = State.A return 10 else: raise KeyError def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def cut(self): return self.update({State.A: [State.B, 0], State.B: [State.F, 2], State.D: [State.E, 6], State.F: [State.G, 9]}) def loop(self): return self.update({State.B: [State.G, 3], State.C: [State.E, 5], State.D: [State.A, 7], State.E: [State.F, 8]}) def herd(self): return self.update({State.B: [State.C, 1], State.C: [State.D, 4]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main: def __init__(self) -> None: self.level = 0 def widen(self): if self.level == 0: self.level = 1 return 0 elif self.level == 1: self.level = 5 return 2 elif self.level == 6: self.level = 3 return 9 elif self.level == 2: self.level = 3 return 3 elif self.level == 3: self.level = 4 return 4 elif self.level == 4: self.level = 5 return 6 else: raise KeyError() def spawn(self): if self.level == 5: self.level = 6 return 8 elif self.level == 3: self.level = 1 return 5 elif self.level == 1: self.level = 2 return 1 elif self.level == 4: self.level = 4 return 7 else: raise KeyError()" "class main: def __init__(self): self.condition = 'A' def check(self): if self.condition == 'A': self.condition = 'B' return 0 elif self.condition == 'C': self.condition = 'D' return 4 elif self.condition == 'D': self.condition = 'D' return 6 elif self.condition == 'E': self.condition = 'F' return 7 elif self.condition == 'F': self.condition = 'D' return 8 else: raise KeyError def drive(self): if self.condition == 'A': self.condition = 'C' return 2 elif self.condition == 'D': self.condition = 'E' return 5 else: raise KeyError def order(self): if self.condition == 'B': self.condition = 'C' return 3 elif self.condition == 'A': self.condition = 'E' return 1 else: raise KeyError" "class StateMachine: state = 'A' def add(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 3 elif self.state == 'F': self.state = 'C' return 8 else: raise KeyError def coat(self): if self.state == 'A': self.state = 'F' return 1 elif self.state == 'C': self.state = 'D' return 4 else: raise KeyError def crack(self): if self.state == 'A': self.state = 'C' return 2 elif self.state == 'C': return 5 elif self.state == 'D': self.state = 'E' return 6 elif self.state == 'E': self.state = 'F' return 7 else: raise KeyError def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class StateMachine: state = State.A def file(self): return self.update({State.A: [State.B, 0], State.F: [State.B, 7], State.G: [State.D, 8], State.E: [State.F, 5]}) def slur(self): return self.update({State.A: [State.E, 1], State.B: [State.C, 2], State.C: [State.D, 3], State.D: [State.E, 4], State.F: [State.G, 6], State.G: [State.A, 9]}) def update(self, transitions): (self.state, value) = transitions[self.state] return value def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class main: state = State.A def bolt(self): return self.update({State.A: [State.B, 0], State.C: [State.D, 2], State.D: [State.D, 5], State.E: [State.F, 6], State.G: [State.G, 11]}) def coat(self): return self.update({State.B: [State.C, 1], State.D: [State.E, 4], State.G: [State.H, 9]}) def split(self): return self.update({State.C: [State.E, 3], State.E: [State.G, 7], State.F: [State.G, 8], State.G: [State.C, 10]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal o = main()" "class StateMachine: state = 'A' def base(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'D': self.state = 'E' return 4 elif self.state == 'C': self.state = 'D' return 3 elif self.state == 'E': self.state = 'F' return 5 elif self.state == 'F': self.state = 'G' return 7 elif self.state == 'G': return 8 else: raise KeyError def slip(self): if self.state == 'A': self.state = 'F' return 1 elif self.state == 'B': self.state = 'C' return 2 elif self.state == 'E': self.state = 'A' return 6 elif self.state == 'G': self.state = 'E' return 9 else: raise KeyError def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class main: state = State.A def snap(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 1], State.C: [State.D, 3], State.D: [State.F, 6], State.F: [State.C, 8]}) def melt(self): return self.update({State.B: [State.F, 2], State.C: [State.A, 4], State.D: [State.E, 5], State.E: [State.F, 7]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal" "class main: def __init__(self): self.condition = 'A' def tag(self): if self.condition == 'A': self.condition = 'A' return 1 elif self.condition == 'B': self.condition = 'C' return 2 elif self.condition == 'C': self.condition = 'C' return 5 elif self.condition == 'G': self.condition = 'A' return 9 else: raise KeyError def init(self): if self.condition == 'A': self.condition = 'B' return 0 elif self.condition == 'C': self.condition = 'D' return 3 elif self.condition == 'E': self.condition = 'F' return 7 elif self.condition == 'F': self.condition = 'G' return 8 else: raise KeyError def apply(self): if self.condition == 'C': self.condition = 'E' return 4 elif self.condition == 'D': self.condition = 'E' return 6 else: raise KeyError" "class sas: def __init__(self): self.state = 1 def mass(self): if self.state == 1: self.state = 2 return 0 elif self.state == 2: self.state = 3 return 2 elif self.state == 3: self.state = 4 return 5 elif self.state == 4: self.state = 8 return 8 else: raise KeyError def slog(self): if self.state == 1: self.state = 5 return 1 elif self.state == 2: self.state = 5 return 4 elif self.state == 6: self.state = 7 return 10 elif self.state == 7: self.state = 8 return 11 else: raise KeyError def push(self): if self.state == 2: self.state = 8 return 3 elif self.state == 3: self.state = 8 return 6 elif self.state == 4: self.state = 5 return 7 elif self.state == 5: self.state = 6 return 9 else: raise KeyError def main(): o = sas() return o" "import re class main: now_letter = 'A' slov_open = {'A': '0B', 'C': '2D', 'F': '8F'} slov_place = {'B': '1C', 'E': '6B', 'F': '7G'} slov_slur = {'C': '3C', 'D': '4E', 'E': '5F', 'F': '9C'} def open(self): temp_open = self.now_letter num = '' letter = '' if self.slov_open.get(temp_open, 'KeyError')[1] != 'e': let = re.findall('\\D', self.slov_open.get(temp_open, 'KeyError')) for e in let: letter += str(e) self.now_letter = letter number = re.findall('\\d', self.slov_open.get(temp_open)) for e in number: num += str(e) return int(num) else: raise KeyError def place(self): temp_place = self.now_letter num = '' letter = '' if self.slov_place.get(temp_place, 'KeyError')[1] != 'e': let = re.findall('\\D', self.slov_place.get(temp_place, 'KeyError')) for e in let: letter += str(e) self.now_letter = letter number = re.findall('\\d', self.slov_place.get(temp_place)) for e in number: num += str(e) return int(num) else: raise KeyError def slur(self): temp_slur = self.now_letter num = '' letter = '' if self.slov_slur.get(temp_slur, 'KeyError')[1] != 'e': let = re.findall('\\D', self.slov_slur.get(temp_slur, 'KeyError')) for e in let: letter += str(e) self.now_letter = letter number = re.findall('\\d', self.slov_slur.get(temp_slur)) for e in number: num += str(e) return int(num) else: raise KeyError" "class A: state = 'A' def unite(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'C': self.state = 'D' return 2 elif self.state == 'D': self.state = 'E' return 4 elif self.state == 'E': self.state = 'H' return 6 elif self.state == 'F': return 9 else: raise KeyError def build(self): if self.state == 'B': self.state = 'C' return 1 elif self.state == 'F': self.state = 'G' return 7 elif self.state == 'G': self.state = 'C' return 11 else: raise KeyError def stall(self): if self.state == 'C': self.state = 'A' return 3 elif self.state == 'E': self.state = 'F' return 5 elif self.state == 'G': self.state = 'H' return 10 else: raise KeyError def rush(self): if self.state == 'F': self.state = 'D' return 8 else: raise KeyError def main(): return A()" "class StateMachine: state = 'A' def speed(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'D' return 2 elif self.state == 'D': self.state = 'E' return 5 elif self.state == 'C': self.state = 'E' return 4 elif self.state == 'E': self.state = 'B' return 8 else: raise KeyError def cut(self): if self.state == 'B': self.state = 'C' return 1 elif self.state == 'C': self.state = 'D' return 3 elif self.state == 'D': self.state = 'A' return 6 elif self.state == 'E': self.state = 'F' return 7 else: raise KeyError def main(): return StateMachine()" "class main: def __init__(self): self.condition = 'A' def throw(self): if self.condition == 'A': self.condition = 'B' return 0 elif self.condition == 'B': self.condition = 'F' return 3 elif self.condition == 'E': self.condition = 'F' return 7 else: raise KeyError def fetch(self): if self.condition == 'B': self.condition = 'C' return 2 elif self.condition == 'C': self.condition = 'D' return 5 elif self.condition == 'D': self.condition = 'E' return 6 elif self.condition == 'A': self.condition = 'G' return 1 else: raise KeyError def trash(self): if self.condition == 'B': self.condition = 'E' return 4 elif self.condition == 'E': self.condition = 'E' return 8 elif self.condition == 'F': self.condition = 'G' return 9 else: raise KeyError" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class StateMachine: state = State.A def hurry(self): return self.update({State.A: [State.B, 0], State.D: [State.D, 6], State.F: [State.A, 8]}) def edit(self): return self.update({State.B: [State.C, 1], State.C: [State.D, 3], State.D: [State.F, 5]}) def glare(self): return self.update({State.B: [State.F, 2], State.D: [State.E, 4], State.E: [State.F, 7]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main: def __init__(self): self.condition = 'A' def run(self): if self.condition == 'A': self.condition = 'B' return 0 elif self.condition == 'C': self.condition = 'D' return 3 elif self.condition == 'F': self.condition = 'D' return 8 elif self.condition == 'G': self.condition = 'H' return 10 else: raise KeyError def mask(self): if self.condition == 'B': self.condition = 'C' return 2 elif self.condition == 'G': self.condition = 'D' return 11 elif self.condition == 'A': self.condition = 'H' return 1 elif self.condition == 'F': self.condition = 'G' return 7 else: raise KeyError def melt(self): if self.condition == 'D': self.condition = 'E' return 5 elif self.condition == 'E': self.condition = 'F' return 6 elif self.condition == 'C': self.condition = 'H' return 4 elif self.condition == 'F': self.condition = 'H' return 9 else: raise KeyError" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class StateMachine: state = State.A def clean(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 1], State.C: [State.A, 4], State.D: [State.D, 6], State.E: [State.E, 7]}) def hike(self): return self.update({State.B: [State.F, 2], State.C: [State.D, 3], State.D: [State.E, 5], State.E: [State.A, 8], State.F: [State.B, 2]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class MyMachine: state = State.A def push(self): if self.state is State.A: return 1 elif self.state is State.D: return 5 else: raise KeyError() def slip(self): if self.state is State.A: self.state = State.B return 0 elif self.state is State.B: self.state = State.C return 2 elif self.state is State.C: self.state = State.D return 3 elif self.state is State.D: self.state = State.A return 6 elif self.state is State.E: self.state = State.A return 8 else: raise KeyError() def rig(self): if self.state is State.D: self.state = State.E return 4 elif self.state is State.E: self.state = State.F return 7 else: raise KeyError() def main(): return MyMachine()" "from enum import Enum, auto class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def place(self): return self.update({State.A: [State.B, 0], State.C: [State.G, 4], State.E: [State.B, 8], State.G: [State.E, 11]}) def open(self): return self.update({State.B: [State.C, 1], State.C: [State.A, 5], State.D: [State.E, 6], State.E: [State.F, 7], State.F: [State.G, 9], State.G: [State.H, 10]}) def look(self): return self.update({State.B: [State.H, 2], State.C: [State.D, 3]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def amble(self): return self.update({State.A: [State.B, 0], State.C: [State.D, 3], State.D: [State.F, 6], State.F: [State.C, 10], State.E: [State.F, 7], State.G: [State.H, 11]}) def coat(self): return self.update({State.B: [State.C, 2], State.C: [State.E, 4], State.D: [State.E, 5], State.A: [State.H, 1], State.E: [State.G, 8], State.F: [State.G, 9]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class Mili: state = 'A' def unite(self): if self.state == 'A': self.state = 'A' return 1 elif self.state == 'B': self.state = 'C' return 2 else: raise KeyError def jog(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'D' return 3 elif self.state == 'C': self.state = 'D' return 5 elif self.state == 'D': self.state = 'E' return 6 else: raise KeyError def scrub(self): if self.state == 'B': self.state = 'E' return 4 elif self.state == 'E': self.state = 'F' return 7 elif self.state == 'F': self.state = 'D' return 8 else: raise KeyError def main(): return Mili()" "class main: def __init__(self): self.point = 'A' def look(self): if self.point == 'A': self.point = 'B' return 0 elif self.point == 'B': self.point = 'C' return 1 elif self.point == 'E': self.point = 'F' return 5 elif self.point == 'F': self.point = 'D' return 8 elif self.point == 'D': self.point = 'A' return 4 else: raise KeyError def click(self): if self.point == 'C': self.point = 'D' return 2 elif self.point == 'D': self.point = 'E' return 3 elif self.point == 'F': self.point = 'B' return 7 elif self.point == 'E': self.point = 'B' return 6 else: raise KeyError" "class main: def __init__(self): self.state = 'A' self.graph = {('A', 'chain'): ('B', 0), ('A', 'cue'): ('E', 1), ('B', 'trace'): ('C', 2), ('C', 'chain'): ('D', 3), ('C', 'cue'): ('E', 4), ('D', 'trace'): ('E', 5), ('E', 'trace'): ('F', 6), ('F', 'cue'): ('C', 7), ('F', 'chain'): ('B', 8)} def chain(self): (self.state, res) = self.graph[self.state, 'chain'] return res def cue(self): (self.state, res) = self.graph[self.state, 'cue'] return res def trace(self): (self.state, res) = self.graph[self.state, 'trace'] return res" "class Machine: state = 'A' def grow(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 2 elif self.state == 'H': self.state = 'D' return 11 else: raise KeyError def amble(self): if self.state == 'A': self.state = 'F' return 1 elif self.state == 'B': self.state = 'E' return 4 elif self.state == 'E': self.state = 'F' return 7 elif self.state == 'F': self.state = 'G' return 8 elif self.state == 'G': self.state = 'H' return 9 else: raise KeyError def type(self): if self.state == 'B': self.state = 'D' return 3 elif self.state == 'C': self.state = 'D' return 5 elif self.state == 'D': self.state = 'E' return 6 elif self.state == 'G': self.state = 'C' return 10 else: raise KeyError def main(): return Machine()" "class Machine: state = 'A' def fork(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': return 2 elif self.state == 'E': self.state = 'F' return 6 elif self.state == 'F': return 10 else: raise KeyError def exit(self): if self.state == 'B': self.state = 'C' return 1 elif self.state == 'C': self.state = 'E' return 4 elif self.state == 'F': self.state = 'G' return 8 elif self.state == 'G': self.state = 'H' return 11 else: raise KeyError def jog(self): if self.state == 'C': self.state = 'D' return 3 elif self.state == 'D': self.state = 'E' return 5 elif self.state == 'E': self.state = 'A' return 7 elif self.state == 'F': self.state = 'H' return 9 else: raise KeyError def main(): return Machine()" "class Machine: state = 'A' def copy(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 1 elif self.state == 'C': self.state = 'E' return 4 elif self.state == 'G': self.state = 'D' return 11 else: raise KeyError def scrub(self): if self.state == 'B': self.state = 'H' return 2 elif self.state == 'D': self.state = 'E' return 5 elif self.state == 'E': self.state = 'F' return 8 else: raise KeyError def boost(self): if self.state == 'C': self.state = 'D' return 3 elif self.state == 'D': self.state = 'B' return 7 else: raise KeyError def init(self): if self.state == 'D': return 6 elif self.state == 'F': self.state = 'G' return 9 elif self.state == 'G': self.state = 'H' return 10 else: raise KeyError def main(): return Machine()" "class Machine: state = 'A' def zoom(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 1 elif self.state == 'D': self.state = 'G' return 5 elif self.state == 'E': self.state = 'C' return 7 elif self.state == 'F': self.state = 'G' return 8 else: raise KeyError def hurry(self): if self.state == 'B': self.state = 'F' return 2 elif self.state == 'C': self.state = 'D' return 3 elif self.state == 'D': self.state = 'E' return 4 elif self.state == 'E': self.state = 'F' return 6 elif self.state == 'F': self.state = 'C' return 9 else: raise KeyError def main(): return Machine()" "class Automat: def __init__(self): self.state = 'A' def snap(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'C': self.state = 'D' return 2 elif self.state == 'D': self.state = 'A' return 4 elif self.state == 'E': self.state = 'F' return 5 else: raise KeyError() def carve(self): if self.state == 'B': self.state = 'C' return 1 elif self.state == 'D': self.state = 'E' return 3 elif self.state == 'E': self.state = 'A' return 6 elif self.state == 'F': self.state = 'G' return 8 else: raise KeyError() def clone(self): if self.state == 'E': self.state = 'G' return 7 elif self.state == 'G': self.state = 'C' return 9 else: raise KeyError() def main(): return Automat()" "class main: def __init__(self): self.__state = 'A' def jump(self): if self.__state == 'A': return 1 if self.__state == 'E': self.__state = 'A' return 8 if self.__state == 'D': self.__state = 'G' return 6 if self.__state == 'F': self.__state = 'G' return 10 raise KeyError def lower(self): if self.__state == 'A': self.__state = 'B' return 0 if self.__state == 'E': self.__state = 'F' return 7 if self.__state == 'D': self.__state = 'E' return 4 raise KeyError def draw(self): if self.__state == 'C': self.__state = 'D' return 3 if self.__state == 'D': self.__state = 'F' return 5 if self.__state == 'G': self.__state = 'H' return 11 raise KeyError def align(self): if self.__state == 'B': self.__state = 'C' return 2 if self.__state == 'E': self.__state = 'B' return 9 raise KeyError" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class main: state = State.A def rush(self): return self.update({State.A: [State.B, 0], State.E: [State.F, 5], State.D: [State.D, 4], State.G: [State.H, 8]}) def hop(self): return self.update({State.C: [State.D, 2], State.E: [State.C, 6], State.G: [State.D, 10], State.F: [State.G, 7]}) def chalk(self): return self.update({State.B: [State.C, 1], State.D: [State.E, 3], State.G: [State.C, 9], State.H: [State.C, 11]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal" "class main: def __init__(self): self.__state = 'A' def view(self): if self.__state == 'A': self.__state = 'B' return 0 if self.__state == 'E': self.__state = 'F' return 6 raise KeyError def patch(self): if self.__state == 'B': self.__state = 'C' return 3 if self.__state == 'C': self.__state = 'D' return 4 if self.__state == 'D': self.__state = 'E' return 5 if self.__state == 'F': self.__state = 'G' return 7 if self.__state == 'G': return 9 if self.__state == 'A': self.__state = 'G' return 2 raise KeyError def send(self): if self.__state == 'C': self.__state = 'D' return 3 if self.__state == 'D': self.__state = 'F' return 5 if self.__state == 'G': self.__state = 'H' return 11 raise KeyError def send(self): if self.__state == 'A': self.__state = 'E' return 1 if self.__state == 'F': self.__state = 'A' return 8 raise KeyError" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def crack(self): return self.update({State.A: [State.B, 0], State.D: [State.A, 4], State.F: [State.A, 7], State.C: [State.D, 2]}) def tag(self): return self.update({State.B: [State.C, 1], State.G: [State.A, 8], State.D: [State.E, 3], State.E: [State.F, 5], State.F: [State.G, 6]}) def trim(self): return self.update({State.G: [State.C, 9]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main: def __init__(self): self.__state = 'A' def show(self): if self.__state == 'A': self.__state = 'B' return 0 if self.__state == 'C': self.__state = 'D' return 3 if self.__state == 'D': self.__state = 'F' return 5 if self.__state == 'E': self.__state = 'F' return 6 if self.__state == 'F': return 8 raise KeyError def carve(self): if self.__state == 'B': self.__state = 'C' return 2 if self.__state == 'A': self.__state = 'D' return 1 if self.__state == 'E': self.__state = 'A' return 7 if self.__state == 'D': self.__state = 'E' return 4 raise KeyError" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class StateMachine: state = State.A def warp(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 1], State.C: [State.D, 3], State.D: [State.E, 5], State.E: [State.F, 6]}) def skew(self): return self.update({State.B: [State.E, 2], State.C: [State.C, 4], State.E: [State.C, 7], State.F: [State.D, 8]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main: def __init__(self): self.state = 'A' def trim(self): if self.state == 'A': self.state = 'B' return 0 if self.state == 'B': self.state = 'C' return 2 if self.state == 'C': self.state = 'E' return 5 raise KeyError def order(self): if self.state == 'A': self.state = 'C' return 1 if self.state == 'B': return 3 if self.state == 'C': self.state = 'D' return 4 if self.state == 'E': self.state = 'F' return 7 raise KeyError def stand(self): if self.state == 'D': self.state = 'E' return 6 if self.state == 'F': self.state = 'D' return 8 raise KeyError" "class main: def __init__(self): start_state = 'A' states = {'A': {'rock': [0, 'B'], 'clone': [1, 'C']}, 'B': {'clone': [2, 'C']}, 'C': {'rock': [3, 'D']}, 'D': {'clone': [4, 'E'], 'rock': [5, 'A']}, 'E': {'rock': [6, 'F']}, 'F': {'clone': [7, 'A'], 'rock': [8, 'B']}} self.state = start_state self.states = states def __getattr__(self, attr): if attr not in self.states[self.state].keys(): raise KeyError self.result = self.states[self.state][attr][0] self.state = self.states[self.state][attr][1] return self.res def res(self): return self.result" "class main: def __init__(self): self.state = 'A' def exit(self): if self.state == 'A': self.state = 'B' return 0 if self.state == 'B': self.state = 'C' return 1 if self.state == 'E': self.state = 'F' return 8 raise KeyError def sort(self): if self.state == 'B': return 2 if self.state == 'C': self.state = 'F' return 6 if self.state == 'E': self.state = 'C' return 9 raise KeyError def stay(self): if self.state == 'B': self.state = 'D' return 3 if self.state == 'C': self.state = 'D' return 5 if self.state == 'F': self.state = 'G' return 10 raise KeyError def check(self): if self.state == 'B': self.state = 'H' return 4 if self.state == 'D': self.state = 'E' return 7 if self.state == 'G': self.state = 'H' return 11 raise KeyError" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def reset(self): return self.update({State.A: [State.A, 1], State.B: [State.C, 2], State.C: [State.D, 4], State.D: [State.E, 6]}) def color(self): return self.update({State.A: [State.B, 0], State.C: [State.C, 5], State.D: [State.F, 7], State.B: [State.E, 3], State.E: [State.F, 8]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class Automate: state = 'A' def cull(self): match self.state: case 'A': self.state = 'B' return 0 case 'F': self.state = 'G' return 6 case 'G': return 9 case _: raise KeyError def color(self): match self.state: case 'B': self.state = 'C' return 2 case 'C': self.state = 'D' return 3 case 'D': self.state = 'E' return 4 case 'E': self.state = 'F' return 5 case 'F': self.state = 'D' return 7 case _: raise KeyError def chip(self): match self.state: case 'A': self.state = 'F' return 1 case 'F': self.state = 'C' return 8 case _: raise KeyError def main(): return Automate()" "class main: def __init__(self): self.__state = 'A' def sway(self): if self.__state == 'A': self.__state = 'B' return 0 if self.__state == 'B': self.__state = 'G' return 2 if self.__state == 'C': self.__state = 'D' return 3 if self.__state == 'D': self.__state = 'F' return 6 if self.__state == 'F': return 9 raise KeyError def mix(self): if self.__state == 'B': self.__state = 'C' return 1 if self.__state == 'C': self.__state = 'E' return 4 if self.__state == 'D': self.__state = 'E' return 5 if self.__state == 'E': self.__state = 'F' return 7 if self.__state == 'F': self.__state = 'G' return 8 raise KeyError" "class main: def __init__(self): self.state = 'A' self.graph = {('A', 'build'): ('B', 0), ('B', 'build'): ('C', 1), ('C', 'build'): ('C', 3), ('C', 'peep'): ('D', 2), ('D', 'peep'): ('D', 5), ('D', 'build'): ('E', 4), ('E', 'peep'): ('B', 7), ('E', 'build'): ('F', 6), ('F', 'build'): ('D', 8)} def build(self): (self.state, ret) = self.graph[self.state, 'build'] return ret def peep(self): (self.state, ret) = self.graph[self.state, 'peep'] return ret" "class main: def __init__(self): self.state = 'A' self.graph = {('A', 'paste'): ('B', 0), ('A', 'stash'): ('D', 1), ('B', 'hop'): ('C', 2), ('C', 'paste'): ('D', 3), ('D', 'hop'): ('E', 4), ('D', 'skid'): ('G', 5), ('E', 'skid'): ('F', 6), ('F', 'paste'): ('G', 7), ('F', 'skid'): ('D', 8), ('F', 'stash'): ('A', 9), ('F', 'hop'): ('F', 10), ('G', 'stash'): ('H', 11)} def skid(self): (self.state, ret) = self.graph[self.state, 'skid'] return ret def paste(self): (self.state, ret) = self.graph[self.state, 'paste'] return ret def hop(self): (self.state, ret) = self.graph[self.state, 'hop'] return ret def stash(self): (self.state, ret) = self.graph[self.state, 'stash'] return ret" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def merge(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 2], State.C: [State.G, 6], State.H: [State.B, 11]}) def shift(self): return self.update({State.A: [State.C, 1], State.B: [State.D, 4], State.C: [State.D, 5], State.F: [State.G, 9], State.G: [State.H, 11]}) def color(self): return self.update({State.B: [State.E, 3], State.D: [State.E, 7], State.E: [State.F, 8], State.F: [State.C, 10]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "def main(): return mili() class mili: def __init__(self): self.state = 'A' def draw(self): match self.state: case 'A': self.state = 'B' return 0 case 'C': self.state = 'F' return 3 case 'G': self.state = 'G' return 10 case _: raise KeyError() def base(self): match self.state: case 'B': self.state = 'C' return 1 case 'C': self.state = 'D' return 2 case 'F': self.state = 'G' return 7 case 'G': self.state = 'C' return 9 case 'H': self.state = 'A' return 11 case _: raise KeyError() def chain(self): match self.state: case 'C': self.state = 'A' return 4 case 'D': self.state = 'E' return 5 case 'E': self.state = 'F' return 6 case 'G': self.state = 'H' return 8 case _: raise KeyError()" "def main(): class auto: def __init__(self): self.state = 'A' def march(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'D': self.state = 'F' return 6 elif self.state == 'B': self.state = 'H' return 2 elif self.state == 'E': self.state = 'F' return 7 elif self.state == 'H': self.state = 'F' return 10 elif self.state == 'C': self.state = 'D' return 4 else: raise KeyError def herd(self): if self.state == 'B': self.state = 'C' return 1 elif self.state == 'D': self.state = 'E' return 5 else: raise KeyError def melt(self): if self.state == 'B': self.state = 'E' return 3 elif self.state == 'F': self.state = 'G' return 8 elif self.state == 'G': self.state = 'H' return 9 elif self.state == 'H': return 11 else: raise KeyError return auto()" "class main: def __init__(self): self._state = 'A' self._graph = {('A', 'chat'): ('A', 2), ('A', 'chalk'): ('B', 0), ('B', 'chat'): ('B', 4), ('B', 'chalk'): ('C', 3), ('C', 'chat'): ('D', 6), ('D', 'warp'): ('E', 7), ('E', 'chat'): ('F', 8), ('A', 'warp'): ('F', 1), ('B', 'warp'): ('F', 5)} def chat(self): (self._state, ret) = self._graph[self._state, 'chat'] return ret def chalk(self): (self._state, ret) = self._graph[self._state, 'chalk'] return ret def warp(self): (self._state, ret) = self._graph[self._state, 'warp'] return ret" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class StateMachine: state = State.A def sweep(self): return self.update({State.A: [State.B, 0], State.D: [State.E, 7], State.C: [State.F, 6], State.B: [State.E, 3]}) def coast(self): return self.update({State.C: [State.D, 5], State.B: [State.C, 2], State.A: [State.G, 1], State.E: [State.F, 8], State.F: [State.G, 9]}) def snap(self): return self.update({State.B: [State.G, 4]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class M: def __init__(self): self.state = 'A' def speed(self): if self.state == 'A': return 1 elif self.state == 'C': self.state = 'H' return 4 elif self.state == 'D': self.state = 'B' return 7 elif self.state == 'E': self.state = 'H' return 9 elif self.state == 'G': self.state = 'H' return 11 else: raise KeyError def align(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'C': return 5 elif self.state == 'F': self.state = 'G' return 10 else: raise KeyError def widen(self): if self.state == 'B': self.state = 'C' return 2 elif self.state == 'C': self.state = 'D' return 3 elif self.state == 'D': self.state = 'E' return 6 elif self.state == 'E': self.state = 'F' return 8 else: raise KeyError def main(): obj = M() return obj" "class main: def __init__(self): self._state = 'A' self._graph = {('A', 'crack'): ('B', 0), ('B', 'march'): ('C', 1), ('C', 'lower'): ('D', 2), ('C', 'march'): ('H', 3), ('D', 'march'): ('E', 4), ('D', 'lower'): ('H', 5), ('E', 'crack'): ('F', 6), ('E', 'march'): ('C', 7), ('F', 'lower'): ('G', 8), ('G', 'crack'): ('H', 9), ('H', 'crack'): ('F', 10), ('H', 'march'): ('H', 11)} def crack(self): (self._state, ret) = self._graph[self._state, 'crack'] return ret def march(self): (self._state, ret) = self._graph[self._state, 'march'] return ret def lower(self): (self._state, ret) = self._graph[self._state, 'lower'] return ret" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class StateMachine: state = State.A def step(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 2], State.D: [State.D, 6]}) def zoom(self): return self.update({State.A: [State.E, 1], State.B: [State.B, 3], State.D: [State.F, 7]}) def tag(self): return self.update({State.C: [State.D, 4], State.D: [State.E, 5], State.E: [State.F, 8]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main: def __init__(self): self.state = 'A' self.graph = {('A', 'begin'): ('B', 0), ('A', 'model'): ('E', 1), ('B', 'model'): ('C', 2), ('C', 'model'): ('D', 3), ('D', 'model'): ('E', 4), ('D', 'sway'): ('D', 5), ('E', 'model'): ('F', 6), ('F', 'begin'): ('A', 7), ('F', 'sway'): ('F', 8)} def model(self): (self.state, ret) = self.graph[self.state, 'model'] return ret def sway(self): (self.state, ret) = self.graph[self.state, 'sway'] return ret def begin(self): (self.state, ret) = self.graph[self.state, 'begin'] return ret" "class main: def __init__(self): self.state = 'A' self.graph = {('A', 'send'): ('B', 0), ('A', 'show'): ('D', 1), ('B', 'show'): ('C', 2), ('C', 'show'): ('D', 3), ('C', 'send'): ('E', 4), ('D', 'show'): ('E', 5), ('E', 'send'): ('F', 6), ('F', 'send'): ('G', 7), ('F', 'show'): ('B', 8), ('G', 'send'): ('C', 9)} def send(self): (self.state, ret) = self.graph[self.state, 'send'] return ret def show(self): (self.state, ret) = self.graph[self.state, 'show'] return ret" "class MealyMachine(object): def __init__(self): self.state = 'A' def share(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'C': self.state = 'D' return 2 elif self.state == 'E': self.state = 'F' return 4 elif self.state == 'F': self.state = 'G' return 8 else: raise KeyError def zoom(self): if self.state == 'B': self.state = 'C' return 1 elif self.state == 'E': self.state = 'G' return 7 else: raise KeyError def stash(self): if self.state == 'D': self.state = 'E' return 3 elif self.state == 'E': self.state = 'B' return 5 else: raise KeyError def punch(self): if self.state == 'F': self.state = 'C' return 9 elif self.state == 'E': self.state = 'C' return 6 else: raise KeyError def main(): return MealyMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class StateMachine: state = State.A def move(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 1], State.C: [State.D, 2], State.D: [State.E, 4]}) def show(self): return self.update({State.D: [State.B, 5], State.E: [State.F, 7], State.F: [State.F, 8]}) def build(self): return self.update({State.C: [State.C, 3], State.D: [State.F, 6]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class StateMachine: state = State.A def widen(self): return self.update({State.A: [State.B, 0], State.C: [State.D, 3], State.D: [State.E, 5]}) def bend(self): return self.update({State.B: [State.C, 2], State.C: [State.C, 4], State.F: [State.B, 8], State.E: [State.F, 7], State.A: [State.E, 1], State.D: [State.D, 6]}) def join(self): return self.update({State.E: [State.F, 6]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main: def __init__(self): self.word = 'A' def sit(self): if self.word == 'A': self.word = 'B' return 0 elif self.word == 'C': self.word = 'D' return 3 elif self.word == 'F': self.word = 'C' return 9 elif self.word == 'E': self.word = 'B' return 7 else: raise KeyError() def erase(self): if self.word == 'B': self.word = 'C' return 1 elif self.word == 'D': self.word = 'E' return 4 elif self.word == 'E': self.word = 'E' return 6 elif self.word == 'F': self.word = 'G' return 8 else: raise KeyError() def blame(self): if self.word == 'B': self.word = 'F' return 2 elif self.word == 'E': self.word = 'F' return 5 else: raise KeyError()" "class main: state = 'A' def throw(self): return self.changeover({'A': ['B', 0], 'B': ['E', 3], 'E': ['C', 8], 'C': ['F', 5]}) def bolt(self): return self.changeover({'B': ['C', 2], 'C': ['D', 4], 'D': ['E', 6], 'E': ['F', 7], 'A': ['F', 1]}) def changeover(self, transitions): output = transitions[self.state][1] self.state = transitions[self.state][0] return output" "class Machine: def __init__(self): self.status = 'A' def mass(self): if self.status == 'A': self.status = 'B' return 0 if self.status == 'C': self.status = 'E' return 3 if self.status == 'D': self.status = 'G' return 5 if self.status == 'F': self.status = 'G' return 8 else: raise KeyError def base(self): if self.status == 'B': self.status = 'C' return 1 if self.status == 'E': self.status = 'F' return 6 else: raise KeyError def erase(self): if self.status == 'E': self.status = 'B' return 7 if self.status == 'G': self.status = 'A' return 9 if self.status == 'C': self.status = 'D' return 2 if self.status == 'D': self.status = 'E' return 4 else: raise KeyError def main(): return Machine()" "class main: def __init__(self): self.condition = 'A' def cut(self): if self.condition == 'A': self.condition = 'A' return 2 elif self.condition == 'C': self.condition = 'D' return 5 elif self.condition == 'D': self.condition = 'F' return 7 else: raise KeyError def zoom(self): if self.condition == 'A': self.condition = 'B' return 0 elif self.condition == 'B': self.condition = 'C' return 4 elif self.condition == 'D': self.condition = 'E' return 6 else: raise KeyError def type(self): if self.condition == 'A': self.condition = 'D' return 1 elif self.condition == 'E': self.condition = 'F' return 8 else: raise KeyError def log(self): if self.condition == 'A': self.condition = 'F' return 3 else: raise KeyError" "class main: def __init__(self): self.condition = 'A' def chalk(self): if self.condition == 'A': self.condition = 'B' return 0 elif self.condition == 'D': self.condition = 'B' return 5 elif self.condition == 'E': self.condition = 'F' return 6 elif self.condition == 'F': self.condition = 'C' return 8 else: raise KeyError def punch(self): if self.condition == 'B': self.condition = 'C' return 2 elif self.condition == 'C': self.condition = 'D' return 3 elif self.condition == 'D': self.condition = 'E' return 4 elif self.condition == 'E': self.condition = 'B' return 7 elif self.condition == 'A': self.condition = 'F' return 1 else: raise KeyError" "class main: def __init__(self): self.word = 'A' def tail(self): if self.word == 'A': self.word = 'A' return 1 elif self.word == 'B': self.word = 'C' return 2 elif self.word == 'D': self.word = 'E' return 6 elif self.word == 'F': self.word = 'F' return 8 else: raise KeyError() def look(self): if self.word == 'C': self.word = 'F' return 5 elif self.word == 'B': self.word = 'D' return 3 elif self.word == 'E': self.word = 'F' return 7 else: raise KeyError() def trash(self): if self.word == 'A': self.word = 'B' return 0 elif self.word == 'C': self.word = 'D' return 4 else: raise KeyError()" "class main: def __init__(self): self.state = 'A' self.graph = {('A', 'amass'): ('B', 0), ('A', 'cull'): ('D', 1), ('B', 'amass'): ('C', 2), ('C', 'amass'): ('D', 3), ('C', 'cull'): ('F', 4), ('D', 'cull'): ('E', 5), ('D', 'amass'): ('F', 6), ('E', 'amass'): ('F', 7), ('E', 'cull'): ('A', 8)} def amass(self): (self.state, ret) = self.graph[self.state, 'amass'] return ret def cull(self): (self.state, ret) = self.graph[self.state, 'cull'] return ret" "class MilesFSM: def __init__(self): self.state = 'A' def grow(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'E' return 2 elif self.state == 'G': self.state = 'A' return 11 elif self.state == 'D': self.state = 'E' return 5 else: raise KeyError def get(self): if self.state == 'B': self.state = 'C' return 1 elif self.state == 'C': self.state = 'D' return 4 elif self.state == 'D': self.state = 'A' return 6 elif self.state == 'G': self.state = 'H' return 10 else: raise KeyError def load(self): if self.state == 'B': self.state = 'G' return 3 elif self.state == 'E': self.state = 'F' return 8 elif self.state == 'F': self.state = 'G' return 9 elif self.state == 'D': self.state = 'H' return 7 else: raise KeyError def main(): obj = MilesFSM() return obj" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class StateMachine: state = State.A def paint(self): return self.update({State.A: [State.B, 0], State.B: [State.B, 2], State.D: [State.B, 5], State.E: [State.E, 7], State.F: [State.D, 8]}) def brake(self): return self.update({State.B: [State.C, 1], State.C: [State.D, 3], State.D: [State.E, 4], State.E: [State.F, 6]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class StateMachine: state = 'A' def open(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 2 elif self.state == 'C': self.state = 'D' return 3 elif self.state == 'E': self.state = 'F' return 6 elif self.state == 'G': self.state = 'H' return 10 elif self.state == 'H': self.state = 'C' return 11 else: raise KeyError def add(self): if self.state == 'A': self.state = 'C' return 1 elif self.state == 'C': self.state = 'F' return 4 elif self.state == 'D': self.state = 'E' return 5 elif self.state == 'E': self.state = 'C' return 7 elif self.state == 'F': self.state = 'G' return 9 else: raise KeyError def drive(self): if self.state == 'E': self.state = 'A' return 8 else: raise KeyError def main(): return StateMachine()" "class Miles_FSM: def __init__(self): self.state = 'A' def grow(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'D': self.state = 'A' return 5 elif self.state == 'F': self.state = 'F' return 9 else: raise KeyError def run(self): if self.state == 'D': self.state = 'D' return 4 elif self.state == 'F': self.state = 'G' return 7 elif self.state == 'G': self.state = 'H' return 10 elif self.state == 'H': self.state = 'B' return 11 else: raise KeyError def cut(self): if self.state == 'B': self.state = 'C' return 1 elif self.state == 'C': self.state = 'D' return 2 elif self.state == 'D': self.state = 'E' return 3 elif self.state == 'E': self.state = 'F' return 6 elif self.state == 'F': self.state = 'A' return 8 else: raise KeyError def main(): obj = Miles_FSM() return obj" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class StateMachine: state = State.A def tag(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 1], State.C: [State.D, 3], State.D: [State.D, 6], State.E: [State.B, 8]}) def melt(self): return self.update({State.C: [State.E, 4], State.D: [State.E, 5], State.E: [State.F, 7], State.B: [State.F, 2]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class FSM: def __init__(self): self.A = 'A' self.B = 'B' self.C = 'C' self.D = 'D' self.E = 'E' self.F = 'F' self.G = 'G' self.start = self.A self.current_state = self.start def fork(self): if self.current_state == self.A: self.current_state = self.B return 0 elif self.current_state == self.B: return 4 elif self.current_state == self.C: self.current_state = self.E return 6 else: raise KeyError def dash(self): if self.current_state == self.A: self.current_state = self.D return 1 elif self.current_state == self.D: self.current_state = self.E return 7 else: raise KeyError def tweak(self): if self.current_state == self.B: self.current_state = self.C return 3 elif self.current_state == self.C: self.current_state = self.D return 5 elif self.current_state == self.A: self.current_state = self.E return 2 elif self.current_state == self.E: self.current_state = self.F return 8 elif self.current_state == self.F: self.current_state = self.G return 9 else: raise KeyError def main(): state_machine = FSM() return state_machine" "def main(): class Op: def __init__(self): self.state = 'A' def chalk(self): mmap = {'A': ('B', 0), 'B': ('C', 2), 'C': ('D', 3), 'D': ('E', 4), 'E': ('F', 6), 'F': ('G', 7), 'G': ('D', 9)} if self.state in mmap.keys(): t = mmap[self.state] self.state = t[0] return t[1] raise KeyError def move(self): mmap = {'D': ('B', 5), 'G': ('E', 8), 'A': ('D', 1)} if self.state in mmap.keys(): t = mmap[self.state] self.state = t[0] return t[1] raise KeyError return Op()" "class Mili: pos = 'A' def send(self): if self.pos == 'A': self.pos = 'B' return 0 elif self.pos == 'D': self.pos = 'E' return 3 elif self.pos == 'E': self.pos = 'F' return 4 elif self.pos == 'F': self.pos = 'G' return 7 else: raise KeyError def pull(self): if self.pos == 'B': self.pos = 'C' return 1 elif self.pos == 'E': self.pos = 'G' return 5 elif self.pos == 'F': self.pos = 'C' return 8 else: raise KeyError def walk(self): if self.pos == 'C': self.pos = 'D' return 2 elif self.pos == 'E': self.pos = 'C' return 6 elif self.pos == 'F': self.pos = 'A' return 9 else: raise KeyError def main(): return Mili()" "class main: def __init__(self): self.point = 'A' def stare(self): if self.point == 'A': self.point = 'A' return 1 elif self.point == 'C': self.point = 'D' return 3 elif self.point == 'D': self.point = 'E' return 6 elif self.point == 'E': self.point = 'F' return 7 else: raise KeyError def shade(self): if self.point == 'A': self.point = 'B' return 0 elif self.point == 'C': self.point = 'F' return 4 else: raise KeyError def model(self): if self.point == 'B': self.point = 'C' return 2 elif self.point == 'C': self.point = 'E' return 5 elif self.point == 'F': self.point = 'B' return 8 else: raise KeyError" "class main: def __init__(self): self.dct = {'A': [[self.slog, self.base], [0, 1], ['B', 'E']], 'B': [[self.slog, self.base], [2, 3], ['C', 'F']], 'C': [[self.slog, self.base], [4, 5], ['D', 'C']], 'D': [[self.base], [6], ['E']], 'E': [[self.slog, self.base], [7, 8], ['F', 'B']], 'F': []} self.state = 'A' self.k = 0 def slog(self): temp = self.dct[self.state] if self.slog in temp[0]: self.state = temp[2][temp[0].index(self.slog)] self.k = temp[1][temp[0].index(self.slog)] return self.k else: raise KeyError def base(self): temp = self.dct[self.state] if self.base in temp[0]: self.state = temp[2][temp[0].index(self.base)] self.k = temp[1][temp[0].index(self.base)] return self.k else: raise KeyError" "class main: def __init__(self): self.tmp = 'A' def build(self): match self.tmp: case 'A': self.tmp = 'A' return 1 case 'D': self.tmp = 'A' return 5 case 'E': self.tmp = 'F' return 6 raise KeyError def skew(self): match self.tmp: case 'A': self.tmp = 'B' return 0 case 'B': self.tmp = 'C' return 2 case 'C': self.tmp = 'D' return 3 case 'D': self.tmp = 'E' return 4 case 'F': self.tmp = 'D' return 8 case 'E': self.tmp = 'A' return 7 raise KeyError" "class main(object): state = 'A' def __init__(self): pass def debug(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'E': self.state = 'B' return 7 elif self.state == 'F': self.state = 'F' return 9 else: raise KeyError def crash(self): if self.state == 'B': self.state = 'C' return 1 elif self.state == 'C': self.state = 'C' return 4 elif self.state == 'F': self.state = 'G' return 8 else: raise KeyError def melt(self): if self.state == 'B': self.state = 'F' return 2 elif self.state == 'C': self.state = 'D' return 3 elif self.state == 'D': self.state = 'E' return 5 elif self.state == 'E': self.state = 'F' return 6 else: raise KeyError" "class Miles_FSM: def __init__(self): self.state = 'A' def carve(self): if self.state == 'A': self.state = 'B' return 0 if self.state == 'B': self.state = 'C' return 1 elif self.state == 'C': self.state = 'D' return 2 elif self.state == 'E': self.state = 'B' return 5 elif self.state == 'F': self.state = 'G' return 6 elif self.state == 'H': self.state = 'B' return 11 else: raise KeyError def rush(self): if self.state == 'D': self.state = 'E' return 3 elif self.state == 'E': self.state = 'F' return 4 elif self.state == 'F': self.state = 'F' return 7 elif self.state == 'E': self.state = 'F' return 5 elif self.state == 'F': self.state = 'A' return 8 elif self.state == 'H': self.state = 'C' return 9 else: raise KeyError def hoard(self): if self.state == 'G': self.state = 'H' return 8 elif self.state == 'H': self.state = 'A' return 10 else: raise KeyError def main(): obj = Miles_FSM() return obj" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def coat(self): return self.update({State.A: [State.B, 0], State.D: [State.E, 4], State.E: [State.F, 7]}) def stop(self): return self.update({State.B: [State.C, 1], State.C: [State.G, 3], State.D: [State.D, 5], State.F: [State.G, 8], State.G: [State.H, 10]}) def walk(self): return self.update({State.C: [State.D, 2], State.D: [State.G, 6], State.F: [State.D, 9], State.G: [State.B, 11]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def show(self): return self.update({State.A: [State.B, 0], State.B: [State.F, 2], State.C: [State.D, 3], State.F: [State.G, 7]}) def crush(self): return self.update({State.G: [State.B, 9], State.D: [State.E, 5], State.H: [State.F, 11]}) def peek(self): return self.update({State.B: [State.C, 1], State.C: [State.A, 4], State.G: [State.E, 10]}) def view(self): return self.update({State.E: [State.F, 6], State.G: [State.H, 8]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main: def __init__(self): self.condition = 'A' def paint(self): if self.condition == 'A': self.condition = 'B' return 0 elif self.condition == 'B': self.condition = 'C' return 2 elif self.condition == 'C': self.condition = 'D' return 3 elif self.condition == 'D': self.condition = 'F' return 5 elif self.condition == 'E': self.condition = 'F' return 7 else: raise KeyError def clean(self): if self.condition == 'A': self.condition = 'E' return 1 elif self.condition == 'D': self.condition = 'E' return 4 elif self.condition == 'E': self.condition = 'C' return 8 else: raise KeyError def reset(self): if self.condition == 'D': self.condition = 'A' return 6 else: raise KeyError" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class StateMachine: state = State.A def drag(self): return self.update({State.A: [State.B, 0], State.B: [State.F, 2], State.C: [State.F, 5], State.D: [State.E, 6], State.F: [State.G, 8]}) def bolt(self): return self.update({State.B: [State.C, 1], State.C: [State.D, 3], State.F: [State.A, 9]}) def run(self): return self.update({State.C: [State.E, 4], State.E: [State.F, 7]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): a = 1 b = 2 c = 3 d = 4 e = 5 f = 6 g = 7 class automate: state = State.a def share(self): if automate.state == State.a: automate.state = State.b return 0 elif automate.state == State.b: return 3 else: raise KeyError def jog(self): if automate.state == State.b: automate.state = State.c return 2 elif automate.state == State.c: automate.state = State.d return 4 elif automate.state == State.d: automate.state = State.e return 5 elif automate.state == State.e: return 7 else: raise KeyError def model(self): if automate.state == State.a: automate.state = State.d return 1 elif automate.state == State.e: automate.state = State.f return 6 elif automate.state == State.f: automate.state = State.g return 8 elif automate.state == State.g: automate.state = State.a return 9 else: raise KeyError def main(): return automate()" "class main: def __init__(self): self.condition = 'A' def amble(self): if self.condition == 'A': self.condition = 'B' return 0 elif self.condition == 'B': self.condition = 'C' return 2 elif self.condition == 'C': self.condition = 'D' return 3 elif self.condition == 'D': self.condition = 'E' return 4 elif self.condition == 'E': self.condition = 'B' return 7 elif self.condition == 'F': self.condition = 'C' return 8 else: raise KeyError def slip(self): if self.condition == 'A': self.condition = 'D' return 1 elif self.condition == 'E': self.condition = 'F' return 6 elif self.condition == 'D': self.condition = 'B' return 5 else: raise KeyError" "class A: state = 'A' def slur(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 1 elif self.state == 'D': self.state = 'E' return 4 elif self.state == 'F': self.state = 'G' return 7 else: raise KeyError def type(self): if self.state == 'C': return 3 elif self.state == 'E': self.state = 'F' return 5 elif self.state == 'F': self.state = 'C' return 8 else: raise KeyError def play(self): if self.state == 'C': self.state = 'D' return 2 elif self.state == 'E': return 6 elif self.state == 'F': self.state = 'A' return 9 else: raise KeyError def main(): return A() o = main()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def clean(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 2], State.C: [State.A, 4], State.F: [State.G, 7], State.G: [State.G, 10], State.H: [State.H, 11]}) def hop(self): return self.update({State.A: [State.E, 1], State.C: [State.D, 3], State.D: [State.E, 5], State.E: [State.F, 6], State.F: [State.F, 8], State.G: [State.H, 9]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class Machine: state = 'A' def trace(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'C': self.state = 'A' return 4 elif self.state == 'E': self.state = 'F' return 7 else: raise KeyError def chip(self): if self.state == 'A': self.state = 'F' return 1 elif self.state == 'B': self.state = 'C' return 2 elif self.state == 'C': return 5 elif self.state == 'D': self.state = 'E' return 6 else: raise KeyError def scrub(self): if self.state == 'C': self.state = 'D' return 3 elif self.state == 'E': self.state = 'B' return 8 else: raise KeyError def main(): return Machine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def skid(self): return self.update({State.A: [State.B, 0], State.C: [State.D, 3]}) def pull(self): return self.update({State.A: [State.G, 1], State.B: [State.C, 2], State.C: [State.E, 6], State.E: [State.F, 8], State.F: [State.F, 10], State.D: [State.E, 7]}) def stash(self): return self.update({State.C: [State.H, 4], State.G: [State.H, 11]}) def coast(self): return self.update({State.C: [State.G, 5], State.F: [State.G, 9]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main: def __init__(self): self.state = 'A' def pose(self): state = self.state if state == 'A': self.state = 'B' return 0 elif state == 'B': raise KeyError elif state == 'C': self.state = 'F' return 3 elif state == 'D': self.state = 'E' return 4 elif state == 'E': self.state = 'F' return 5 elif state == 'F': self.state = 'G' return 7 elif state == 'G': self.state = 'E' return 9 def turn(self): state = self.state if state == 'A': raise KeyError elif state == 'B': self.state = 'C' return 1 elif state == 'C': self.state = 'D' return 2 elif state == 'D': raise KeyError elif state == 'E': return 6 elif state == 'F': raise KeyError elif state == 'G': self.state = 'C' return 8" "class FSM: def __init__(self): self.A = 'A' self.B = 'B' self.C = 'C' self.D = 'D' self.E = 'E' self.F = 'F' self.start = self.A self.current_state = self.start def rush(self): if self.current_state == self.A: self.current_state = self.B return 0 elif self.current_state == self.D: self.current_state = self.A return 5 else: raise KeyError def daub(self): if self.current_state == self.B: self.current_state = self.C return 1 elif self.current_state == self.C: self.current_state = self.D return 2 elif self.current_state == self.D: return 4 elif self.current_state == self.E: return 7 else: raise KeyError def smash(self): if self.current_state == self.F: self.current_state = self.B return 8 elif self.current_state == self.E: self.current_state = self.F return 6 elif self.current_state == self.D: self.current_state = self.E return 3 else: raise KeyError def main(): state_machine = FSM() return state_machine" "class main: now_letter = 'A' slov_align = {'A': '0B', 'B': '3C', 'D': '6E', 'F': '9F'} slov_bolt = {'A': '1D', 'C': '5D', 'E': '7F', 'F': '8G'} slov_sway = {'B': '4G', 'A': '2G'} def align(self): temp_align = self.now_letter if self.slov_align.get(temp_align, 'Keyrror')[1] != 'e': self.now_letter = self.slov_align.get(temp_align, 'KeyError')[1] return int(self.slov_align.get(temp_align)[0]) else: raise KeyError def bolt(self): temp_bolt = self.now_letter if self.slov_bolt.get(temp_bolt, 'KeyError')[1] != 'e': self.now_letter = self.slov_bolt.get(temp_bolt, 'KeyError')[1] return int(self.slov_bolt.get(temp_bolt)[0]) else: raise KeyError def sway(self): temp_sway = self.now_letter if self.slov_sway.get(temp_sway, 'Keyrror')[1] != 'e': self.now_letter = self.slov_sway.get(temp_sway, 'KeyError')[1] return int(self.slov_sway.get(temp_sway)[0]) else: raise KeyError" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class StateMachine: state = State.A def step(self): return self.update({State.A: [State.B, 0], State.C: [State.A, 4], State.D: [State.E, 5], State.E: [State.E, 7], State.F: [State.G, 8]}) def mask(self): return self.update({State.A: [State.F, 1], State.B: [State.C, 2], State.C: [State.D, 3], State.E: [State.F, 6], State.F: [State.F, 9]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main: def __init__(self): self.condition = 'A' def jog(self): if self.condition == 'A': self.condition = 'B' return 0 elif self.condition == 'C': self.condition = 'F' return 3 else: raise KeyError def align(self): if self.condition == 'C': self.condition = 'D' return 2 elif self.condition == 'D': self.condition = 'E' return 5 elif self.condition == 'E': self.condition = 'F' return 7 elif self.condition == 'F': self.condition = 'D' return 8 else: raise KeyError def mix(self): if self.condition == 'B': self.condition = 'C' return 1 elif self.condition == 'D': self.condition = 'B' return 6 elif self.condition == 'C': self.condition = 'E' return 4 else: raise KeyError" "class main: def __init__(self): self.condition = 'A' def copy(self): if self.condition == 'A': self.condition = 'B' return 0 elif self.condition == 'D': self.condition = 'A' return 4 elif self.condition == 'G': self.condition = 'H' return 8 else: raise KeyError def blame(self): if self.condition == 'B': self.condition = 'C' return 1 elif self.condition == 'E': self.condition = 'F' return 5 elif self.condition == 'F': self.condition = 'G' return 7 elif self.condition == 'G': self.condition = 'A' return 11 else: raise KeyError def tread(self): if self.condition == 'G': self.condition = 'E' return 10 elif self.condition == 'E': self.condition = 'H' return 6 else: raise KeyError def add(self): if self.condition == 'C': self.condition = 'D' return 2 elif self.condition == 'D': self.condition = 'E' return 3 elif self.condition == 'G': self.condition = 'G' return 9 else: raise KeyError" "class main: def __init__(self): self.name = 'A' def skew(self): if self.name == 'A': self.name = 'B' return 0 elif self.name == 'B': self.name = 'C' return 1 elif self.name == 'C': self.name = 'D' return 3 elif self.name == 'E': self.name = 'F' return 5 elif self.name == 'F': self.name = 'G' return 7 else: raise KeyError def slur(self): if self.name == 'B': return 2 elif self.name == 'D': self.name = 'E' return 4 elif self.name == 'E': self.name = 'B' return 6 elif self.name == 'F': self.name = 'C' return 8 elif self.name == 'G': self.name = 'A' return 9 else: raise KeyError" "class main: def __init__(self): self.condition = 'A' def flip(self): if self.condition == 'A': self.condition = 'B' return 0 elif self.condition == 'C': self.condition = 'D' return 4 elif self.condition == 'E': self.condition = 'F' return 7 elif self.condition == 'F': self.condition = 'F' return 8 else: raise KeyError def link(self): if self.condition == 'A': self.condition = 'E' return 1 elif self.condition == 'B': self.condition = 'F' return 3 else: raise KeyError def sit(self): if self.condition == 'B': self.condition = 'C' return 2 elif self.condition == 'D': self.condition = 'E' return 6 elif self.condition == 'C': self.condition = 'A' return 5 else: raise KeyError" "class main: def __init__(self): self.condition = 'A' def flip(self): if self.condition == 'A': self.condition = 'B' return 0 elif self.condition == 'F': self.condition = 'G' return 7 elif self.condition == 'G': self.condition = 'H' return 9 else: raise KeyError def make(self): if self.condition == 'B': self.condition = 'C' return 3 elif self.condition == 'C': self.condition = 'D' return 4 elif self.condition == 'D': self.condition = 'E' return 5 elif self.condition == 'A': self.condition = 'E' return 2 elif self.condition == 'H': self.condition = 'F' return 11 else: raise KeyError def hop(self): if self.condition == 'G': self.condition = 'B' return 10 elif self.condition == 'E': self.condition = 'F' return 6 elif self.condition == 'F': self.condition = 'F' return 8 elif self.condition == 'A': self.condition = 'H' return 1 else: raise KeyError" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class StateMachine: state = State.A def start(self): return self.update({State.A: [State.B, 0], State.C: [State.D, 4], State.D: [State.B, 6]}) def loop(self): return self.update({State.A: [State.F, 1], State.G: [State.B, 9]}) def fetch(self): return self.update({State.B: [State.C, 3], State.D: [State.E, 5], State.E: [State.F, 7], State.F: [State.G, 8], State.A: [State.G, 2]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class StateMachine: state = State.A def group(self): return self.update({State.A: [State.B, 0], State.C: [State.A, 4], State.E: [State.E, 7], State.F: [State.C, 8]}) def cull(self): return self.update({State.B: [State.C, 1], State.D: [State.E, 5], State.E: [State.F, 6]}) def get(self): return self.update({State.B: [State.B, 2], State.C: [State.D, 3]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class StateMachine: state = State.A def jump(self): return self.update({State.A: [State.B, 0], State.C: [State.A, 3], State.B: [State.C, 1], State.E: [State.F, 5]}) def shift(self): return self.update({State.C: [State.D, 2], State.E: [State.B, 7], State.D: [State.E, 4]}) def paint(self): return self.update({State.E: [State.C, 6], State.F: [State.B, 8]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main: def __init__(self): self.word = 'A' def click(self): if self.word == 'A': self.word = 'B' return 0 elif self.word == 'C': self.word = 'D' return 2 elif self.word == 'D': self.word = 'E' return 4 elif self.word == 'F': self.word = 'G' return 7 elif self.word == 'E': self.word = 'A' return 6 elif self.word == 'G': self.word = 'H' return 8 else: raise KeyError() def race(self): if self.word == 'B': self.word = 'C' return 1 elif self.word == 'C': self.word = 'H' return 3 elif self.word == 'G': self.word = 'B' return 10 else: raise KeyError() def skew(self): if self.word == 'E': self.word = 'F' return 5 elif self.word == 'G': self.word = 'G' return 9 elif self.word == 'H': self.word = 'F' return 11 else: raise KeyError()" "class Mili: state = -1 def fill(self): if self.state in [-1, 6]: self.state = 0 elif self.state == 0: self.state = 1 elif self.state in [5, 4, 8]: self.state = 7 elif self.state == 7: self.state = 11 else: raise KeyError return self.state def coast(self): if self.state in [1, 9]: self.state = 2 elif self.state in [2, 11]: self.state = 3 elif self.state == 3: self.state = 6 elif self.state in [4, 5, 8]: self.state = 9 else: raise KeyError return self.state def fade(self): if self.state in [2, 11]: self.state = 4 elif self.state == 3: self.state = 5 elif self.state in [5, 4, 8]: self.state = 8 elif self.state == 7: self.state = 10 else: raise KeyError return self.state def main(): return Mili()" "class main(object): state = 'A' def __init__(self): pass def turn(self): if self.state == 'B': self.state = 'C' return 1 elif self.state == 'F': self.state = 'D' return 6 elif self.state == 'G': self.state = 'C' return 8 else: raise KeyError def flip(self): if self.state == 'D': self.state = 'E' return 3 elif self.state == 'E': self.state = 'F' return 4 elif self.state == 'G': self.state = 'G' return 9 else: raise KeyError def cue(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'C': self.state = 'D' return 2 elif self.state == 'F': self.state = 'G' return 5 elif self.state == 'G': self.state = 'B' return 7 else: raise KeyError" "class main(object): def __init__(self): self.state = 'A' def begin(self): if self.state == 'B': self.state = 'E' return 3 elif self.state == 'C': self.state = 'D' return 4 elif self.state == 'D': self.state = 'E' return 6 elif self.state == 'F': self.state = 'G' return 8 elif self.state == 'A': self.state = 'G' return 1 else: raise KeyError def order(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 2 elif self.state == 'C': self.state = 'G' return 5 elif self.state == 'E': self.state = 'F' return 7 elif self.state == 'F': self.state = 'C' return 9 else: raise KeyError" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def dash(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 4]}) def crawl(self): return self.update({State.A: [State.C, 1], State.D: [State.E, 7]}) def peek(self): return self.update({State.B: [State.D, 5], State.A: [State.F, 3], State.E: [State.F, 8]}) def move(self): return self.update({State.A: [State.D, 2], State.C: [State.D, 6], State.F: [State.G, 9]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class StateMachine: state = State.A def make(self): return self.update({State.A: [State.B, 0], State.D: [State.B, 6], State.C: [State.D, 4], State.E: [State.F, 7]}) def get(self): return self.update({State.A: [State.C, 1], State.B: [State.C, 3], State.E: [State.E, 8]}) def stop(self): return self.update({State.A: [State.D, 2], State.D: [State.E, 5]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main: def __init__(self): self.point = 'A' def fade(self): if self.point == 'A': self.point = 'H' return 1 elif self.point == 'B': self.point = 'G' return 3 elif self.point == 'F': self.point = 'B' return 10 elif self.point == 'E': self.point = 'F' return 8 elif self.point == 'D': self.point = 'G' return 7 elif self.point == 'C': self.point = 'D' return 4 elif self.point == 'G': self.point = 'H' return 11 else: raise KeyError def view(self): if self.point == 'A': self.point = 'B' return 0 elif self.point == 'B': self.point = 'C' return 2 elif self.point == 'C': self.point = 'A' return 5 elif self.point == 'D': self.point = 'E' return 6 elif self.point == 'F': self.point = 'G' return 9 else: raise KeyError" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class StateMachine: state = State.A def drag(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 2], State.C: [State.C, 4], State.D: [State.E, 5], State.E: [State.F, 6], State.F: [State.C, 8]}) def stand(self): return self.update({State.A: [State.F, 1], State.C: [State.D, 3], State.F: [State.G, 7], State.G: [State.E, 9]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class main: state = State.A def open(self): return self.update({State.A: [State.B, 0], State.B: [State.F, 3], State.C: [State.D, 4], State.D: [State.D, 6], State.E: [State.F, 8]}) def slog(self): return self.update({State.A: [State.C, 1], State.B: [State.C, 2], State.D: [State.F, 7]}) def tag(self): return self.update({State.D: [State.E, 5]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class StateMachine: state = State.A def hike(self): return self.update({State.A: [State.A, 1], State.C: [State.E, 4], State.D: [State.E, 6], State.E: [State.F, 8]}) def stare(self): return self.update({State.B: [State.C, 2], State.C: [State.D, 3]}) def throw(self): return self.update({State.A: [State.B, 0], State.C: [State.A, 5], State.D: [State.D, 7]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class StateMachine: state = State.A def punch(self): return self.update({State.A: [State.D, 1], State.E: [State.F, 7], State.B: [State.D, 4]}) def fade(self): return self.update({State.A: [State.B, 0], State.B: [State.B, 3], State.C: [State.D, 5]}) def etch(self): return self.update({State.B: [State.C, 2], State.E: [State.C, 8], State.D: [State.E, 6]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class StateMachine: state = 'A' def skew(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'C': self.state = 'A' return 3 elif self.state == 'E': self.state = 'B' return 7 else: raise KeyError def post(self): if self.state == 'B': self.state = 'C' return 1 elif self.state == 'C': self.state = 'D' return 2 elif self.state == 'F': self.state = 'B' return 8 elif self.state == 'E': self.state = 'F' return 5 else: raise KeyError def snap(self): if self.state == 'E': self.state = 'A' return 6 elif self.state == 'D': self.state = 'E' return 4 else: raise KeyError def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class StateMachine: def __init__(self): self.state = State.A def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def build(self): return self.update({State.A: [State.B, 0], State.C: [State.D, 2], State.D: [State.E, 3], State.E: [State.B, 6], State.F: [State.B, 8]}) def peep(self): return self.update({State.B: [State.C, 1], State.D: [State.A, 4], State.E: [State.F, 5], State.F: [State.G, 7], State.G: [State.E, 9]}) def main(): return StateMachine()" "class Node: def __init__(self): self.data = None self.status = 'A' def func_menu(self, func): if func == 'fade': return self.fork() elif func == 'pluck': return self.brake() elif func == 'slur': return self.paste() def fade(self): if self.status == 'A': self.data = 0 self.status = 'B' elif self.status == 'C': self.data = 3 self.status = 'C' elif self.status == 'D': self.data = 5 self.status = 'E' elif self.status == 'F': self.data = 8 self.status = 'C' else: raise KeyError return self.data def pluck(self): if self.status == 'B': self.data = 1 self.status = 'C' elif self.status == 'G': self.data = 9 self.status = 'E' elif self.status == 'C': self.data = 4 self.status = 'G' else: raise KeyError return self.data def slur(self): if self.status == 'C': self.data = 2 self.status = 'D' elif self.status == 'E': self.data = 6 self.status = 'F' elif self.status == 'F': self.data = 7 self.status = 'G' else: raise KeyError return self.data def main(): return Node() o = main()" "class FSM: def __init__(self): self.A = 'A' self.B = 'B' self.C = 'C' self.D = 'D' self.E = 'E' self.F = 'F' self.G = 'G' self.H = 'H' self.start = self.A self.current_state = self.start def push(self): if self.current_state == self.A: self.current_state = self.B return 0 elif self.current_state == self.C: self.current_state = self.H return 4 elif self.current_state == self.F: self.current_state = self.F return 8 elif self.current_state == self.G: self.current_state = self.E return 10 else: raise KeyError def grow(self): if self.current_state == self.B: self.current_state = self.C return 1 elif self.current_state == self.D: self.current_state = self.E return 5 elif self.current_state == self.F: self.current_state = self.G return 7 elif self.current_state == self.H: self.current_state = self.D return 11 else: raise KeyError def clear(self): if self.current_state == self.B: self.current_state = self.D return 2 elif self.current_state == self.C: self.current_state = self.D return 3 elif self.current_state == self.E: self.current_state = self.F return 6 elif self.current_state == self.G: self.current_state = self.H return 9 else: raise KeyError def main(): state_machine = FSM() return state_machine" "class StateMachine: state = 'A' def loop(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 1 elif self.state == 'C': self.state = 'A' return 3 elif self.state == 'H': self.state = 'B' return 11 elif self.state == 'G': self.state = 'H' return 8 else: raise KeyError def blame(self): if self.state == 'C': self.state = 'D' return 2 elif self.state == 'E': self.state = 'F' return 5 elif self.state == 'F': self.state = 'G' return 6 elif self.state == 'G': self.state = 'G' return 10 else: raise KeyError def draw(self): if self.state == 'D': self.state = 'E' return 4 elif self.state == 'G': self.state = 'E' return 9 elif self.state == 'F': self.state = 'C' return 7 else: raise KeyError def main(): return StateMachine()" "class Machine: state = 'A' def draw(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'D': self.state = 'B' return 5 elif self.state == 'E': self.state = 'G' return 8 else: raise KeyError def place(self): if self.state == 'B': self.state = 'C' return 1 elif self.state == 'D': return 4 else: raise KeyError def log(self): if self.state == 'C': self.state = 'D' return 2 elif self.state == 'D': self.state = 'F' return 6 elif self.state == 'E': self.state = 'F' return 7 else: raise KeyError def sway(self): if self.state == 'D': self.state = 'E' return 3 elif self.state == 'F': self.state = 'G' return 9 else: raise KeyError def main(): return Machine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def exit(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 1], State.C: [State.D, 4], State.F: [State.G, 10]}) def pan(self): return self.update({State.B: [State.F, 3], State.C: [State.C, 6], State.D: [State.A, 8], State.E: [State.F, 9]}) def smash(self): return self.update({State.B: [State.H, 2], State.C: [State.E, 5], State.D: [State.E, 7], State.G: [State.H, 11]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class Mealy: state = State.A def close(self): return self.update({State.A: [State.B, 0], State.B: [State.G, 2], State.C: [State.D, 3], State.D: [State.E, 5], State.E: [State.F, 6], State.F: [State.G, 7], State.G: [State.A, 8]}) def crawl(self): return self.update({State.B: [State.C, 1], State.C: [State.G, 4], State.G: [State.G, 9]}) def update(self, transition): (self.state, signal) = transition[self.state] return signal def main(): return Mealy()" "class Mealy: def __init__(self): self.state = -1 self.states = {-1: {'t': 0}, 0: {'p': 1, 't': 2, 'l': 3}, 1: {'l': 4}, 2: {'p': 7}, 3: {'p': 1, 't': 2, 'l': 3}, 4: {'t': 5, 'l': 6}, 5: {'p': 7}, 6: {'p': 1, 't': 2, 'l': 3}, 7: {'t': 8}, 8: {'t': 8}} def trim(self): self.state = self.states[self.state]['t'] return self.state def look(self): self.state = self.states[self.state]['l'] return self.state def peep(self): self.state = self.states[self.state]['p'] return self.state def main(): return Mealy()" "class Mealy: def __init__(self): self.state = -1 self.states = {-1: {'p': 0, 'l': 1}, 0: {'l': 2, 's': 3}, 1: {'p': 4}, 2: {'p': 4}, 3: {'l': 5}, 4: {'l': 5}, 5: {'s': 6}, 6: {'p': 7, 'l': 8, 's': 9}, 7: {'t': 0}, 8: {'p': 4}, 9: {'l': 2, 's': 3}} def shade(self): self.state = self.states[self.state]['s'] return self.state def link(self): self.state = self.states[self.state]['l'] return self.state def pan(self): self.state = self.states[self.state]['p'] return self.state def main(): return Mealy()" "class Machine: state = 'A' def move(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'C': self.state = 'D' return 3 elif self.state == 'D': self.state = 'E' return 5 elif self.state == 'F': self.state = 'B' return 9 elif self.state == 'G': return 11 else: raise KeyError def widen(self): if self.state == 'A': self.state = 'F' return 1 elif self.state == 'B': self.state = 'C' return 2 elif self.state == 'E': self.state = 'F' return 6 elif self.state == 'F': self.state = 'C' return 8 elif self.state == 'G': self.state = 'H' return 10 else: raise KeyError def mix(self): if self.state == 'C': self.state = 'E' return 4 elif self.state == 'F': self.state = 'G' return 7 else: raise KeyError def main(): return Machine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class StateMachine: state = State.A def hoard(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 3], State.E: [State.E, 8]}) def crawl(self): return self.update({State.A: [State.C, 1], State.B: [State.G, 4], State.C: [State.D, 5], State.E: [State.F, 7], State.F: [State.G, 9]}) def split(self): return self.update({State.A: [State.G, 2], State.D: [State.E, 6]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class StateMachine: state = State.A def order(self): return self.update({State.A: [State.B, 0], State.C: [State.C, 4], State.D: [State.B, 6], State.E: [State.F, 7], State.G: [State.C, 9]}) def erase(self): return self.update({State.A: [State.C, 1], State.B: [State.C, 2], State.C: [State.D, 3], State.D: [State.E, 5], State.F: [State.G, 8]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class StateMachine: state = State.A def clean(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 2], State.C: [State.E, 6]}) def tag(self): return self.update({State.A: [State.A, 1], State.C: [State.A, 5], State.E: [State.F, 8]}) def slur(self): return self.update({State.B: [State.B, 3], State.C: [State.D, 4], State.D: [State.E, 7]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class Milli: def __init__(self): self.sost = 'A' def chalk(self): if self.sost == 'A': self.sost = 'B' return 0 elif self.sost == 'F': self.sost = 'C' return 8 else: raise KeyError def lower(self): if self.sost == 'B': self.sost = 'C' return 1 elif self.sost == 'C': self.sost = 'D' return 2 elif self.sost == 'E': self.sost = 'F' return 5 elif self.sost == 'F': self.sost = 'A' return 9 else: raise KeyError def smash(self): if self.sost == 'C': self.sost = 'C' return 3 elif self.sost == 'D': self.sost = 'E' return 4 elif self.sost == 'E': self.sost = 'E' return 6 elif self.sost == 'F': self.sost = 'G' return 7 else: raise KeyError def main(): return Milli()" "class main: def __init__(self): self.__state = 'A' def crawl(self): if self.__state == 'A': return 1 raise KeyError def close(self): if self.__state == 'A': self.__state = 'B' return 0 if self.__state == 'B': self.__state = 'F' return 5 if self.__state == 'D': self.__state = 'E' return 7 if self.__state == 'E': self.__state = 'F' return 8 raise KeyError def exit(self): if self.__state == 'A': self.__state = 'F' return 2 if self.__state == 'B': self.__state = 'C' return 4 if self.__state == 'C': self.__state = 'D' return 6 raise KeyError def slip(self): if self.__state == 'A': self.__state = 'D' return 3 raise KeyError" "class StateMachine: state = 'A' def draw(self): if self.state == 'A': self.state = 'A' return 2 elif self.state == 'B': self.state = 'C' return 3 elif self.state == 'D': self.state = 'E' return 5 else: raise KeyError def wreck(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'D': self.state = 'D' return 6 elif self.state == 'E': self.state = 'F' return 8 else: raise KeyError def zoom(self): if self.state == 'C': self.state = 'D' return 4 elif self.state == 'D': self.state = 'F' return 7 elif self.state == 'A': self.state = 'F' return 1 else: raise KeyError def main(): return StateMachine()" "class main(object): def __init__(self): self.__state = 'A' def begin(self): if self.__state == 'A': self.__state = 'B' return 0 if self.__state == 'B': self.__state = 'C' return 1 if self.__state == 'C': self.__state = 'D' return 3 if self.__state == 'D': self.__state = 'B' return 7 if self.__state == 'E': self.__state = 'F' return 8 raise KeyError def tweak(self): if self.__state == 'B': self.__state = 'E' return 2 if self.__state == 'C': self.__state = 'A' return 4 raise KeyError def herd(self): if self.__state == 'C': self.__state = 'E' return 5 if self.__state == 'D': return 6 raise KeyError" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def copy(self): return self.update({State.A: [State.B, 0], State.D: [State.E, 4], State.E: [State.F, 5], State.F: [State.G, 8]}) def debug(self): return self.update({State.B: [State.C, 1], State.C: [State.D, 3], State.E: [State.A, 6]}) def load(self): return self.update({State.B: [State.E, 2], State.E: [State.E, 7], State.F: [State.B, 9]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class States: A = list() B = list() C = list() D = list() E = list() F = list() G = list() H = list() class StateMachine: state = States.A def __init__(self): States.A.append(('erase', 0, States.B)) States.B.append(('init', 1, States.C)) States.C.append(('init', 2, States.D)) States.C.append(('scale', 3, States.H)) States.D.append(('init', 4, States.E)) States.E.append(('wreck', 5, States.F)) States.E.append(('scale', 6, States.B)) States.E.append(('init', 7, States.G)) States.E.append(('erase', 8, States.C)) States.F.append(('scale', 9, States.G)) States.G.append(('scale', 10, States.H)) States.H.append(('erase', 11, States.A)) def __get_next_node(self, method_name): found = None for node in self.state: if node[0] == method_name: found = node break return found def base_method(self, next_state): if next_state is not None: self.state = next_state[2] return next_state[1] else: raise KeyError('No such edge!') def erase(self): next_state = self.__get_next_node('erase') return self.base_method(next_state) def init(self): next_state = self.__get_next_node('init') return self.base_method(next_state) def scale(self): next_state = self.__get_next_node('scale') return self.base_method(next_state) def wreck(self): next_state = self.__get_next_node('wreck') return self.base_method(next_state) def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def peek(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 1], State.E: [State.F, 4], State.F: [State.B, 7], State.G: [State.B, 10]}) def cast(self): return self.update({State.C: [State.D, 2], State.G: [State.H, 8]}) def view(self): return self.update({State.D: [State.E, 3], State.E: [State.E, 5], State.F: [State.G, 6], State.G: [State.A, 9], State.H: [State.E, 11]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class Milly: def __init__(self): self.rule = 'A' def edit(self): if self.rule == 'A': self.rule = 'B' return 0 if self.rule == 'C': self.rule = 'A' return 4 if self.rule == 'E': self.rule = 'F' return 8 if self.rule == 'D': self.rule = 'F' return 7 else: raise KeyError def get(self): if self.rule == 'B': self.rule = 'C' return 1 if self.rule == 'C': return 5 if self.rule == 'D': self.rule = 'E' return 6 else: raise KeyError def sort(self): if self.rule == 'B': self.rule = 'D' return 2 if self.rule == 'C': self.rule = 'D' return 3 else: raise KeyError def main(): o = Milly() return o" "class main: def __init__(self): self.condition = 'A' def skip(self): if self.condition == 'A': self.condition = 'B' return 0 elif self.condition == 'B': self.condition = 'C' return 1 elif self.condition == 'D': self.condition = 'E' return 3 elif self.condition == 'E': self.condition = 'E' return 6 elif self.condition == 'F': self.condition = 'B' return 8 else: raise KeyError def daub(self): if self.condition == 'C': self.condition = 'D' return 2 elif self.condition == 'D': self.condition = 'A' return 4 elif self.condition == 'E': self.condition = 'F' return 5 else: raise KeyError def herd(self): if self.condition == 'E': self.condition = 'A' return 7 raise KeyError" "class Milli: def __init__(self): self.state = 'A' def close(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 2 elif self.state == 'C': return 4 elif self.state == 'D': self.state = 'B' return 6 elif self.state == 'E': self.state = 'F' return 7 elif self.state == 'F': return 8 else: raise KeyError def open(self): if self.state == 'A': self.state = 'E' return 1 elif self.state == 'C': self.state = 'D' return 3 elif self.state == 'D': self.state = 'E' return 5 else: raise KeyError def main(): obj = Milli() return obj" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def mask(self): return self.update({State.A: [State.B, 0], State.B: [State.D, 3], State.E: [State.G, 8], State.G: [State.H, 10], State.H: [State.C, 11]}) def hurry(self): return self.update({State.A: [State.C, 1], State.E: [State.H, 7]}) def zoom(self): return self.update({State.B: [State.C, 2], State.C: [State.D, 4], State.E: [State.F, 6], State.D: [State.E, 5], State.F: [State.G, 9]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class StateMachine: state = State.A def log(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 1], State.D: [State.E, 5], State.F: [State.F, 9]}) def stay(self): return self.update({State.B: [State.D, 2], State.C: [State.C, 4], State.E: [State.F, 6], State.F: [State.D, 8]}) def herd(self): return self.update({State.C: [State.D, 3], State.F: [State.G, 7]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class M: def __init__(self): self.state = 'A' def type(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 1 elif self.state == 'C': self.state = 'D' return 2 elif self.state == 'D': self.state = 'E' return 3 elif self.state == 'E': self.state = 'F' return 5 elif self.state == 'F': self.state = 'B' return 8 else: raise KeyError def slur(self): if self.state == 'D': self.state = 'B' return 4 elif self.state == 'E': self.state = 'B' return 6 elif self.state == 'F': self.state = 'G' return 7 elif self.state == 'G': self.state = 'D' return 9 else: raise KeyError def main(): obj = M() return obj" "class main: def __init__(self): self._state = 'A' self._graph = {('A', 'punch'): ('B', 0), ('B', 'paste'): ('C', 1), ('B', 'punch'): ('H', 2), ('C', 'punch'): ('D', 3), ('D', 'exit'): ('E', 4), ('E', 'paste'): ('B', 6), ('E', 'exit'): ('F', 5), ('F', 'paste'): ('F', 8), ('F', 'exit'): ('G', 7), ('G', 'shade'): ('G', 10), ('G', 'punch'): ('H', 9), ('G', 'paste'): ('D', 11)} def punch(self): (self._state, ret) = self._graph[self._state, 'punch'] return ret def paste(self): (self._state, ret) = self._graph[self._state, 'paste'] return ret def exit(self): (self._state, ret) = self._graph[self._state, 'exit'] return ret def shade(self): (self._state, ret) = self._graph[self._state, 'shade'] return ret" "class Mili: currentNode = 'A' def shade(self): if self.currentNode == 'A': raise KeyError if self.currentNode == 'B': return 2 if self.currentNode == 'C': self.currentNode = 'E' return 4 if self.currentNode == 'D': self.currentNode = 'F' return 6 if self.currentNode == 'E': raise KeyError if self.currentNode == 'F': self.currentNode = 'C' return 8 def sort(self): if self.currentNode == 'A': self.currentNode = 'B' return 0 if self.currentNode == 'B': self.currentNode = 'C' return 1 if self.currentNode == 'C': self.currentNode = 'D' return 3 if self.currentNode == 'D': self.currentNode = 'E' return 5 if self.currentNode == 'E': self.currentNode = 'F' return 7 if self.currentNode == 'F': raise KeyError def main(): o = Mili() return o" "class main: def __init__(self): self.state = 'A' def step(self): if self.state == 'A': self.state = 'B' return 0 if self.state == 'D': self.state = 'E' return 4 if self.state == 'E': self.state = 'F' return 5 else: raise KeyError def drive(self): if self.state == 'B': self.state = 'C' return 2 if self.state == 'E': self.state = 'B' return 6 if self.state == 'F': self.state = 'D' return 8 else: raise KeyError def move(self): if self.state == 'A': self.state = 'F' return 1 if self.state == 'C': self.state = 'D' return 3 if self.state == 'F': self.state = 'G' return 7 if self.state == 'G': self.state = 'G' return 9 else: raise KeyError" "class main: name = 'A' def sit(self): if self.name == 'A': self.name = 'B' return 0 elif self.name == 'B': self.name = 'G' return 2 elif self.name == 'D': self.name = 'E' return 4 elif self.name == 'G': self.name = 'C' return 10 elif self.name == 'E': self.name = 'F' return 6 elif self.name == 'H': self.name = 'A' return 11 elif self.name == 'F': self.name = 'G' return 7 else: raise KeyError def post(self): if self.name == 'B': self.name = 'C' return 1 elif self.name == 'C': self.name = 'D' return 3 elif self.name == 'D': self.name = 'A' return 5 elif self.name == 'F': self.name = 'H' return 8 elif self.name == 'G': self.name = 'H' return 9 else: raise KeyError" "class main: def __init__(self): self.name = 'A' def jump(self): if self.name == 'A': self.name = 'B' return 0 elif self.name == 'C': self.name = 'A' return 4 elif self.name == 'D': self.name = 'E' return 5 else: raise KeyError def glare(self): if self.name == 'A': self.name = 'E' return 1 elif self.name == 'B': self.name = 'C' return 2 elif self.name == 'C': self.name = 'D' return 3 elif self.name == 'D': self.name = 'F' return 6 elif self.name == 'E': self.name = 'F' return 7 elif self.name == 'F': return 8 else: raise KeyError" "class main: def __init__(self): self.name = 'A' def tag(self): if self.name == 'A': self.name = 'B' return 0 elif self.name == 'B': self.name = 'C' return 2 elif self.name == 'D': self.name = 'E' return 5 elif self.name == 'E': self.name = 'H' return 8 elif self.name == 'F': self.name = 'G' return 9 elif self.name == 'G': self.name = 'H' return 11 else: raise KeyError def punch(self): if self.name == 'A': self.name = 'G' return 1 elif self.name == 'B': self.name = 'D' return 3 elif self.name == 'C': self.name = 'D' return 4 elif self.name == 'D': self.name = 'G' return 6 elif self.name == 'E': self.name = 'F' return 7 elif self.name == 'F': self.name = 'A' return 10 else: raise KeyError" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class StateMachine: state = State.A def rush(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 1], State.C: [State.D, 2], State.D: [State.E, 4], State.E: [State.B, 7], State.F: [State.G, 8], State.G: [State.B, 9]}) def send(self): return self.update({State.C: [State.E, 3], State.D: [State.G, 5], State.E: [State.F, 6]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def fork(self): return self.update({State.A: [State.B, 0], State.E: [State.G, 7], State.F: [State.G, 8], State.H: [State.B, 11]}) def log(self): return self.update({State.A: [State.G, 1], State.B: [State.C, 2], State.D: [State.E, 4]}) def peep(self): return self.update({State.C: [State.D, 3], State.D: [State.A, 5], State.E: [State.F, 6], State.G: [State.H, 10], State.F: [State.B, 9]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class Mile: def __init__(self): self.state = 'A' def chain(self): if self.state == 'A': self.state = 'B' return 0 if self.state == 'C': self.state = 'C' return 3 if self.state == 'E': self.state = 'C' return 7 raise KeyError def amble(self): if self.state == 'B': self.state = 'C' return 1 if self.state == 'D': self.state = 'E' return 5 if self.state == 'C': self.state = 'G' return 4 if self.state == 'E': self.state = 'F' return 6 if self.state == 'F': self.state = 'G' return 8 if self.state == 'G': self.state = 'E' return 10 raise KeyError def hurry(self): if self.state == 'C': self.state = 'D' return 2 if self.state == 'G': self.state = 'H' return 9 if self.state == 'H': self.state = 'B' return 11 raise KeyError def main(): return Mile()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def jump(self): return self.update({State.A: [State.B, 0], State.D: [State.E, 4], State.E: [State.F, 5], State.F: [State.G, 8], State.G: [State.B, 11]}) def chip(self): return self.update({State.B: [State.C, 1], State.C: [State.D, 3], State.F: [State.H, 9], State.E: [State.C, 6]}) def skid(self): return self.update({State.G: [State.H, 10], State.E: [State.B, 7], State.B: [State.F, 2]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class Automate: state = '' def __init__(self, x): self.state = x def cast(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'D' return 2 elif self.state == 'D': self.state = 'D' return 5 elif self.state == 'C': self.state = 'D' return 3 elif self.state == 'E': self.state = 'F' return 6 elif self.state == 'F': self.state = 'D' return 9 else: raise KeyError() def draw(self): if self.state == 'B': self.state = 'C' return 1 elif self.state == 'E': self.state = 'B' return 7 elif self.state == 'D': self.state = 'E' return 4 elif self.state == 'F': self.state = 'G' return 8 else: raise KeyError() def main(): return Automate('A')" "class Mili: state = 'A' def walk(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'D' return 2 elif self.state == 'C': self.state = 'D' return 3 elif self.state == 'D': self.state = 'A' return 6 elif self.state == 'E': self.state = 'F' return 7 elif self.state == 'F': self.state = 'F' return 9 else: raise KeyError def cull(self): if self.state == 'C': self.state = 'A' return 4 elif self.state == 'B': self.state = 'C' return 1 elif self.state == 'D': self.state = 'E' return 5 elif self.state == 'F': self.state = 'G' return 8 else: raise KeyError def main(): return Mili()" "class Mile: def __init__(self): self.place = 'a' def scan(self): if self.place == 'a': self.place = 'b' return 0 if self.place == 'b': self.place = 'c' return 1 if self.place == 'c': self.place = 'd' return 2 if self.place == 'd': self.place = 'e' return 4 if self.place == 'e': self.place = 'c' return 6 if self.place == 'f': self.place = 'd' return 8 else: raise KeyError def chat(self): if self.place == 'c': self.place = 'c' return 3 if self.place == 'e': self.place = 'f' return 5 else: raise KeyError def build(self): if self.place == 'e': self.place = 'a' return 7 else: raise KeyError def main(): return Mile()" "class main: current_state = 'A' def paste(self): if self.current_state == 'A': self.current_state = 'B' return 0 elif self.current_state == 'B': self.current_state = 'F' return 2 elif self.current_state == 'C': self.current_state = 'D' return 4 elif self.current_state == 'G': self.current_state = 'H' return 9 elif self.current_state == 'H': self.current_state = 'D' return 10 else: raise KeyError def scale(self): if self.current_state == 'B': self.current_state = 'C' return 1 elif self.current_state == 'D': self.current_state = 'B' return 6 else: raise KeyError def type(self): if self.current_state == 'B': self.current_state = 'E' return 3 elif self.current_state == 'D': self.current_state = 'E' return 5 elif self.current_state == 'E': self.current_state = 'F' return 7 elif self.current_state == 'F': self.current_state = 'G' return 8 elif self.current_state == 'H': self.current_state = 'A' return 11 else: raise KeyError def f9z(): o = main() o.paste() o.type() o.scale() o.type() o.type() o.paste() o.paste() o.scale() o.paste() o.type() o.paste() o.type() o.paste() o.scale() o.paste() o.type() return o" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def mix(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 1], State.C: [State.D, 2], State.D: [State.D, 5], State.E: [State.F, 6], State.F: [State.F, 8], State.G: [State.H, 9]}) def slur(self): return self.update({State.C: [State.F, 3], State.D: [State.E, 4]}) def copy(self): return self.update({State.F: [State.G, 7], State.G: [State.A, 10], State.H: [State.A, 11]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class Machine: s = 'A' def jump(self): if self.s == 'A': self.s = 'B' return 0 elif self.s == 'B': self.s = 'C' return 1 elif self.s == 'D': self.s = 'A' return 6 elif self.s == 'F': return 9 else: raise KeyError def color(self): if self.s == 'C': self.s = 'D' return 4 elif self.s == 'D': self.s = 'E' return 5 elif self.s == 'E': self.s = 'F' return 7 elif self.s == 'F': self.s = 'C' return 10 elif self.s == 'B': self.s = 'H' return 2 elif self.s == 'G': self.s = 'H' return 11 else: raise KeyError def scrub(self): if self.s == 'F': self.s = 'G' return 8 elif self.s == 'B': self.s = 'E' return 3 else: raise KeyError def main(): return Machine()" "class main: def __init__(self): self.condition = 'A' def drag(self): if self.condition == 'A': self.condition = 'B' return 0 elif self.condition == 'C': self.condition = 'A' return 4 elif self.condition == 'D': self.condition = 'H' return 7 else: raise KeyError def rush(self): if self.condition == 'B': self.condition = 'C' return 2 elif self.condition == 'E': self.condition = 'E' return 9 elif self.condition == 'C': self.condition = 'D' return 3 elif self.condition == 'G': self.condition = 'H' return 11 else: raise KeyError def peek(self): if self.condition == 'F': self.condition = 'G' return 10 else: raise KeyError def group(self): if self.condition == 'C': self.condition = 'E' return 5 elif self.condition == 'D': self.condition = 'E' return 6 elif self.condition == 'E': self.condition = 'F' return 8 elif self.condition == 'A': self.condition = 'E' return 1 else: raise KeyError" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class StateMachine: state = State.A def swap(self): return self.update({State.A: [State.B, 0], State.D: [State.E, 6], State.E: [State.F, 8]}) def rig(self): return self.update({State.A: [State.A, 1], State.B: [State.E, 4], State.C: [State.D, 5]}) def mass(self): return self.update({State.A: [State.E, 2], State.B: [State.C, 3], State.D: [State.A, 7]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def sort(self): return self.update({State.A: [State.B, 0], State.D: [State.D, 7], State.B: [State.F, 3], State.E: [State.F, 8], State.G: [State.H, 10]}) def align(self): return self.update({State.B: [State.B, 2], State.F: [State.G, 9], State.G: [State.G, 11]}) def split(self): return self.update({State.B: [State.C, 1]}) def tread(self): return self.update({State.B: [State.H, 4], State.C: [State.D, 5], State.D: [State.E, 6]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class StateMachine: state = State.A def close(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 1], State.C: [State.D, 3], State.D: [State.E, 4], State.F: [State.A, 7]}) def build(self): return self.update({State.B: [State.B, 2], State.D: [State.B, 5], State.E: [State.F, 6], State.F: [State.F, 8]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class Miles_FSM: def __init__(self): self.state = 'A' def fetch(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'F' return 2 elif self.state == 'C': self.state = 'F' return 4 else: raise KeyError def cut(self): if self.state == 'B': self.state = 'C' return 1 elif self.state == 'D': self.state = 'E' return 5 elif self.state == 'E': self.state = 'F' return 7 elif self.state == 'F': self.state = 'A' return 9 else: raise KeyError def crash(self): if self.state == 'C': self.state = 'D' return 3 elif self.state == 'D': self.state = 'G' return 6 elif self.state == 'F': self.state = 'G' return 8 else: raise KeyError def main(): obj = Miles_FSM() return obj" "class States: A = list() B = list() C = list() D = list() E = list() F = list() G = list() class StateMachine: state = States.A def __init__(self): States.A.append(('spawn', 0, States.B)) States.B.append(('spawn', 1, States.C)) States.C.append(('spawn', 3, States.A)) States.C.append(('view', 2, States.D)) States.D.append(('spawn', 4, States.E)) States.E.append(('spawn', 6, States.F)) States.E.append(('view', 7, States.A)) States.F.append(('view', 8, States.G)) States.D.append(('view', 5, States.G)) States.G.append(('spawn', 9, States.G)) def __get_next_node(self, method_name): found = None for node in self.state: if node[0] == method_name: found = node break return found def base_method(self, next_state): if next_state is not None: self.state = next_state[2] return next_state[1] else: raise KeyError('No such edge!') def spawn(self): next_state = self.__get_next_node('spawn') return self.base_method(next_state) def view(self): next_state = self.__get_next_node('view') return self.base_method(next_state) def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def step(self): return self.update({State.A: [State.B, 0], State.C: [State.D, 2], State.D: [State.E, 3], State.E: [State.F, 5], State.F: [State.G, 7], State.G: [State.E, 9]}) def unite(self): return self.update({State.B: [State.C, 1], State.D: [State.B, 4], State.G: [State.G, 10], State.H: [State.A, 11]}) def open(self): return self.update({State.E: [State.A, 6], State.G: [State.H, 8]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class Node: def __init__(self): self.data = None self.status = 'A' def func_menu(self, func): if func == 'run': return self.run() elif func == 'code': return self.code() elif func == 'dash': return self.dash() def run(self): if self.status == 'A': self.data = 0 self.status = 'B' elif self.status == 'E': self.data = 7 self.status = 'E' else: raise KeyError return self.data def code(self): if self.status == 'B': self.data = 2 self.status = 'C' elif self.status == 'C': self.data = 3 self.status = 'D' elif self.status == 'D': self.data = 5 self.status = 'E' elif self.status == 'E': self.data = 6 self.status = 'F' elif self.status == 'F': self.data = 8 self.status = 'B' else: raise KeyError return self.data def dash(self): if self.status == 'A': self.data = 1 self.status = 'F' elif self.status == 'C': self.data = 4 self.status = 'E' else: raise KeyError return self.data def main(): return Node()" "class main: def __init__(self): self.__state = 'A' def build(self): if self.__state == 'A': self.__state = 'B' return 0 if self.__state == 'C': self.__state = 'D' return 2 if self.__state == 'D': return 5 if self.__state == 'E': self.__state = 'F' return 6 if self.__state == 'F': self.__state = 'G' return 7 if self.__state == 'G': return 9 raise KeyError def stall(self): if self.__state == 'B': self.__state = 'C' return 1 if self.__state == 'D': self.__state = 'E' return 4 if self.__state == 'F': self.__state = 'D' return 8 raise KeyError def speed(self): if self.__state == 'C': self.__state = 'G' return 3 raise KeyError" "class Automate(object): state = 'A' def cast(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'C': self.state = 'D' return 2 elif self.state == 'G': self.state = 'C' return 10 else: raise KeyError() def boost(self): if self.state == 'B': self.state = 'C' return 1 elif self.state == 'C': self.state = 'C' return 3 elif self.state == 'D': self.state = 'E' return 5 elif self.state == 'F': self.state = 'G' return 8 elif self.state == 'G': self.state = 'H' return 9 else: raise KeyError() def mute(self): if self.state == 'D': self.state = 'D' return 6 elif self.state == 'E': self.state = 'F' return 7 elif self.state == 'G': self.state = 'B' return 11 elif self.state == 'C': self.state = 'H' return 4 else: raise KeyError() def main(): return Automate()" "class Mile: def __init__(self): self.state = 'A' def tread(self): if self.state == 'A': self.state = 'B' return 0 if self.state == 'D': self.state = 'E' return 3 if self.state == 'E': self.state = 'E' return 6 raise KeyError def chat(self): if self.state == 'B': self.state = 'C' return 1 if self.state == 'C': self.state = 'D' return 2 if self.state == 'E': self.state = 'F' return 4 if self.state == 'F': self.state = 'F' return 8 raise KeyError def throw(self): if self.state == 'E': self.state = 'B' return 5 if self.state == 'F': self.state = 'B' return 7 raise KeyError def main(): return Mile()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class StateMachine: state = State.A def wreck(self): return self.update({State.A: [State.B, 0], State.C: [State.D, 3], State.D: [State.E, 5]}) def trace(self): return self.update({State.A: [State.E, 1], State.B: [State.C, 2], State.C: [State.A, 4], State.D: [State.F, 6], State.E: [State.F, 7], State.F: [State.G, 8], State.G: [State.A, 9]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main: def __init__(self): self.condition = 'A' def boost(self): if self.condition == 'A': self.condition = 'B' return 0 elif self.condition == 'B': self.condition = 'E' return 2 elif self.condition == 'D': self.condition = 'D' return 5 elif self.condition == 'E': self.condition = 'E' return 7 elif self.condition == 'H': self.condition = 'C' return 11 elif self.condition == 'G': self.condition = 'G' return 10 else: raise KeyError def clear(self): if self.condition == 'B': self.condition = 'C' return 1 elif self.condition == 'C': self.condition = 'D' return 3 elif self.condition == 'D': self.condition = 'E' return 4 elif self.condition == 'E': self.condition = 'F' return 6 elif self.condition == 'F': self.condition = 'G' return 8 elif self.condition == 'G': self.condition = 'H' return 9 else: raise KeyError" "class main(object): def __init__(self): self.state = 'A' def crush(self): if self.state == 'A': return 1 elif self.state == 'C': self.state = 'A' return 4 elif self.state == 'B': self.state = 'C' return 2 elif self.state == 'E': self.state = 'F' return 6 elif self.state == 'F': self.state = 'A' return 8 else: raise KeyError def tag(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'C': self.state = 'D' return 3 elif self.state == 'D': self.state = 'E' return 5 elif self.state == 'F': self.state = 'B' return 7 else: raise KeyError" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def fade(self): return self.update({State.A: [State.B, 0], State.C: [State.D, 2], State.D: [State.A, 6], State.G: [State.H, 10]}) def daub(self): return self.update({State.B: [State.C, 1], State.D: [State.D, 5], State.E: [State.C, 8], State.F: [State.G, 9], State.G: [State.A, 11]}) def exit(self): return self.update({State.C: [State.C, 3], State.D: [State.E, 4], State.E: [State.F, 7]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class StateMachine: state = State.A def close(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 2], State.C: [State.D, 5], State.E: [State.F, 7]}) def skew(self): return self.update({State.A: [State.C, 1], State.B: [State.F, 3], State.F: [State.F, 9]}) def swap(self): return self.update({State.B: [State.D, 4], State.D: [State.E, 6], State.F: [State.G, 8]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class Mili: state = -1 def tweak(self): if self.state == -1: self.state = 0 elif self.state in [0, 3]: self.state = 3 elif self.state in [1, 6]: self.state = 6 elif self.state in [4, 2]: self.state = 7 else: raise KeyError return self.state def herd(self): if self.state in [0, 3]: self.state = 1 elif self.state in [1, 6]: self.state = 4 elif self.state == 7: self.state = 8 else: raise KeyError return self.state def warp(self): if self.state in [0, 3]: self.state = 2 elif self.state in [1, 6]: self.state = 5 else: raise KeyError return self.state def main(): return Mili()" "class Mili: state = 'A' def tag(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'E' return 2 elif self.state == 'D': self.state = 'E' return 4 elif self.state == 'E': self.state = 'F' return 6 elif self.state == 'F': self.state = 'F' return 9 else: raise KeyError def debug(self): if self.state == 'B': self.state = 'C' return 1 elif self.state == 'C': self.state = 'D' return 3 elif self.state == 'E': self.state = 'C' return 7 elif self.state == 'D': self.state = 'G' return 5 elif self.state == 'F': self.state = 'G' return 8 else: raise KeyError def main(): return Mili()" "class Machine: state = 'A' def crash(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'C': self.state = 'F' return 3 elif self.state == 'D': return 5 elif self.state == 'E': self.state = 'F' return 7 else: raise KeyError def type(self): if self.state == 'B': self.state = 'C' return 1 elif self.state == 'D': self.state = 'E' return 4 elif self.state == 'E': self.state = 'C' return 8 else: raise KeyError def skip(self): if self.state == 'C': self.state = 'D' return 2 elif self.state == 'D': self.state = 'E' return 6 else: raise KeyError def main(): return Machine()" "class main: def __init__(self): self.state = 'A' def pluck(self): if self.state == 'A': self.state = 'B' return 0 else: raise KeyError() def chat(self): if self.state == 'A': self.state = 'G' return 1 elif self.state == 'B': self.state = 'C' return 4 elif self.state == 'D': self.state = 'E' return 6 elif self.state == 'E': self.state = 'F' return 8 elif self.state == 'F': self.state = 'G' return 9 else: raise KeyError() def stash(self): if self.state == 'A': self.state = 'C' return 2 elif self.state == 'C': self.state = 'D' return 5 elif self.state == 'D': self.state = 'G' return 7 else: raise KeyError() def brake(self): if self.state == 'A': self.state = 'A' return 3 else: raise KeyError() def main(self): return main()" "class main: def __init__(self): self.state = 'A' def check(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'G': self.state = 'B' return 9 elif self.state == 'C': self.state = 'D' return 2 elif self.state == 'E': self.state = 'F' return 7 elif self.state == 'F': self.state = 'G' return 8 else: raise KeyError def view(self): if self.state == 'B': self.state = 'C' return 1 elif self.state == 'C': self.state = 'G' return 4 elif self.state == 'D': self.state = 'E' return 5 else: raise KeyError def peep(self): if self.state == 'C': self.state = 'A' return 3 elif self.state == 'D': self.state = 'F' return 6 else: raise KeyError" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def peek(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 1], State.D: [State.E, 5], State.C: [State.F, 4], State.G: [State.G, 9], State.E: [State.A, 7]}) def crush(self): return self.update({State.B: [State.B, 2], State.C: [State.D, 3], State.E: [State.F, 6], State.F: [State.G, 8]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class Action: def __init__(self, states: dict): self.states = states def act(self, current: str): if current in self.states: _states = self.states[current] else: raise KeyError return _states class FSM: def __init__(self, current: str): self.current = current self.etch_act = Action({'A': ('B', 0), 'E': ('F', 7)}) self.melt_act = Action({'A': ('C', 2), 'C': ('E', 5), 'F': ('G', 8), 'G': ('H', 10)}) self.paste_act = Action({'A': ('G', 1), 'B': ('C', 3), 'C': ('D', 4), 'D': ('E', 6), 'H': ('D', 11), 'F': ('F', 9)}) def speed(self): try: states = self.etch_act.act(self.current) self.current = states[0] return states[1] except KeyError: raise KeyError def make(self): try: states = self.melt_act.act(self.current) self.current = states[0] return states[1] except KeyError: raise KeyError def forge(self): try: states = self.paste_act.act(self.current) self.current = states[0] return states[1] except KeyError: raise KeyError def main(): return FSM('A')" "class Node: def __init__(self): self.data = None self.status = 'A' def base(self): if self.status == 'A': self.data = 0 self.status = 'B' elif self.status == 'B': self.data = 2 elif self.status == 'C': self.data = 3 self.status = 'D' elif self.status == 'E': self.data = 7 self.status = 'F' elif self.status == 'F': self.data = 8 self.status = 'D' else: raise KeyError return self.data def drive(self): if self.status == 'B': self.data = 1 self.status = 'C' elif self.status == 'C': self.data = 4 self.status = 'E' else: raise KeyError return self.data def load(self): if self.status == 'C': self.data = 5 self.status = 'F' elif self.status == 'D': self.data = 6 self.status = 'E' else: raise KeyError return self.data def main(): return Node()" "class StateMachine: state = 'A' def loop(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'E' return 4 elif self.state == 'C': self.state = 'D' return 5 elif self.state == 'D': self.state = 'E' return 6 else: raise KeyError def swap(self): if self.state == 'A': self.state = 'F' return 1 elif self.state == 'D': return 7 else: raise KeyError def scale(self): if self.state == 'A': self.state = 'c' return 2 elif self.state == 'B': self.state = 'C' return 3 elif self.state == 'E': self.state = 'F' return 8 else: raise KeyError def main(): return StateMachine()" "class main: def __init__(self): self.__state = 'A' def erase(self): if self.__state == 'A': self.__state = 'B' return 0 if self.__state == 'B': self.__state = 'C' return 1 if self.__state == 'D': self.__state = 'A' return 4 if self.__state == 'G': self.__state = 'E' return 9 raise KeyError def brake(self): if self.__state == 'C': self.__state = 'D' return 2 if self.__state == 'D': self.__state = 'E' return 3 if self.__state == 'F': self.__state = 'G' return 7 if self.__state == 'E': return 6 raise KeyError def stash(self): if self.__state == 'E': self.__state = 'F' return 5 if self.__state == 'F': self.__state = 'D' return 8 raise KeyError" "class Mili: def __init__(self): self.condition = 'A' def crash(self): if self.condition in ['A', 'E', 'F', 'D']: if self.condition in ['A', 'E']: if self.condition == 'A': self.condition = 'B' return 0 else: self.condition = 'F' return 6 elif self.condition == 'F': self.condition = 'C' return 8 else: self.condition = 'A' return 5 else: raise KeyError def etch(self): if self.condition == 'D': return 4 else: raise KeyError def spawn(self): if self.condition in ['B', 'C', 'D', 'E']: if self.condition in ['B', 'C']: if self.condition == 'B': self.condition = 'C' return 1 else: self.condition = 'D' return 2 elif self.condition == 'D': self.condition = 'E' return 3 else: self.condition = 'C' return 7 else: raise KeyError def main(): return Mili()" "class Mili: state = 'A' def amass(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'G': self.state = 'H' return 8 elif self.state == 'H': self.state = 'H' return 11 else: raise KeyError def run(self): if self.state == 'B': self.state = 'C' return 2 elif self.state == 'G': self.state = 'B' return 9 elif self.state == 'D': self.state = 'E' return 4 elif self.state == 'E': self.state = 'F' return 5 elif self.state == 'F': self.state = 'D' return 7 elif self.state == 'A': self.state = 'H' return 1 else: raise KeyError def send(self): if self.state == 'G': self.state = 'E' return 10 elif self.state == 'C': self.state = 'D' return 3 elif self.state == 'F': self.state = 'G' return 6 else: raise KeyError def main(): return Mili()" "class Action: def __init__(self, states: dict): self.states = states def act(self, current: str): if current in self.states: _states = self.states[current] else: raise KeyError return _states class FSM: def __init__(self, current: str): self.current = current self.etch_act = Action({'A': ('B', 0), 'D': ('E', 4), 'F': ('D', 8), 'E': ('C', 6)}) self.melt_act = Action({'B': ('C', 1), 'E': ('F', 5), 'C': ('A', 3)}) self.paste_act = Action({'E': ('B', 7), 'C': ('D', 2)}) def amass(self): try: states = self.etch_act.act(self.current) self.current = states[0] return states[1] except KeyError: raise KeyError def show(self): try: states = self.melt_act.act(self.current) self.current = states[0] return states[1] except KeyError: raise KeyError def trash(self): try: states = self.paste_act.act(self.current) self.current = states[0] return states[1] except KeyError: raise KeyError def main(): return FSM('A')" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class StateMachine: state = State.A def warp(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 2], State.E: [State.B, 7]}) def view(self): return self.update({State.A: [State.D, 1], State.E: [State.F, 5], State.F: [State.G, 8]}) def carve(self): return self.update({State.C: [State.D, 3], State.D: [State.E, 4], State.E: [State.E, 6], State.F: [State.C, 9]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main: def __init__(self): self.pos = 'A' def scale(self): if self.pos == 'A': self.pos = 'B' return 0 if self.pos == 'C': self.pos = 'D' return 5 if self.pos == 'B': self.pos = 'F' return 4 if self.pos == 'E': return 8 raise KeyError() def mask(self): if self.pos == 'B': return 3 if self.pos == 'D': self.pos = 'E' return 6 raise KeyError() def punch(self): if self.pos == 'A': self.pos = 'C' return 1 if self.pos == 'B': self.pos = 'C' return 2 if self.pos == 'E': self.pos = 'F' return 7 raise KeyError()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class StateMachine: state = State.A def lower(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 1], State.C: [State.D, 3], State.D: [State.E, 5], State.E: [State.F, 6]}) def pan(self): return self.update({State.B: [State.D, 2], State.C: [State.A, 4], State.E: [State.A, 7], State.F: [State.F, 8]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class StateMachine: state = State.A def cue(self): return self.update({State.A: [State.A, 2], State.C: [State.D, 5], State.E: [State.F, 8]}) def turn(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 3], State.C: [State.A, 6]}) def march(self): return self.update({State.B: [State.F, 4], State.F: [State.G, 9], State.A: [State.G, 1], State.D: [State.E, 7]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main: def __init__(self): self.__state = 'A' def pull(self): if self.__state == 'A': self.__state = 'B' return 0 if self.__state == 'C': self.__state = 'E' return 5 if self.__state == 'D': self.__state = 'E' return 6 raise KeyError def show(self): if self.__state == 'A': self.__state = 'D' return 2 if self.__state == 'B': self.__state = 'C' return 3 if self.__state == 'C': self.__state = 'D' return 4 raise KeyError def bolt(self): if self.__state == 'A': self.__state = 'E' return 1 if self.__state == 'D': self.__state = 'F' return 6 if self.__state == 'E': self.__state = 'F' return 8 raise KeyError" "class Miles_FSM: def __init__(self): self.state = 'A' def jog(self): if self.state == 'A': self.state = 'A' return 1 elif self.state == 'B': self.state = 'C' return 2 elif self.state == 'C': self.state = 'D' return 3 elif self.state == 'E': self.state = 'F' return 6 elif self.state == 'F': self.state = 'G' return 8 elif self.state == 'G': self.state = 'E' return 9 else: raise KeyError def split(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'C': self.state = 'F' return 4 elif self.state == 'D': self.state = 'E' return 5 elif self.state == 'E': self.state = 'E' return 7 else: raise KeyError def main(): obj = Miles_FSM() return obj" "class StateMachine: state = 'A' def exit(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 3 elif self.state == 'F': return 8 else: raise KeyError def sway(self): if self.state == 'A': self.state = 'E' return 1 elif self.state == 'C': self.state = 'D' return 4 elif self.state == 'F': self.state = 'D' return 7 else: raise KeyError def trace(self): if self.state == 'A': self.state = 'D' return 2 elif self.state == 'D': self.state = 'E' return 5 elif self.state == 'E': self.state = 'F' return 6 else: raise KeyError def main(): return StateMachine()" "class Mealy: state = 'A' def rev(self): if self.state == 'A': self.state = 'B' return 0 if self.state == 'B': self.state = 'C' return 1 if self.state == 'E': self.state = 'G' return 5 if self.state == 'F': self.state = 'G' return 6 if self.state == 'G': self.state = 'A' return 7 raise KeyError def stall(self): if self.state == 'C': self.state = 'D' return 2 if self.state == 'G': self.state = 'G' return 8 raise KeyError def zoom(self): if self.state == 'D': self.state = 'E' return 3 if self.state == 'E': self.state = 'F' return 4 if self.state == 'G': self.state = 'C' return 9 raise KeyError def main(): o = Mealy() return o" "class MilesFSM: def __init__(self): self.state = 'A' def scan(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 1 elif self.state == 'E': self.state = 'G' return 7 else: raise KeyError def stare(self): if self.state == 'C': self.state = 'D' return 3 elif self.state == 'D': self.state = 'E' return 4 elif self.state == 'B': self.state = 'E' return 2 elif self.state == 'E': self.state = 'F' return 5 elif self.state == 'F': self.state = 'G' return 8 elif self.state == 'G': self.state = 'G' return 9 else: raise KeyError def throw(self): if self.state == 'E': self.state = 'C' return 6 else: raise KeyError def main(): obj = MilesFSM() return obj" "class FSM: states = dict(A=[[0, 'B'], [1, 'C'], [0, '-']], B=[[2, 'C'], [0, '-'], [0, '-']], C=[[4, 'F'], [0, '-'], [3, 'D']], D=[[5, 'E'], [6, 'B'], [7, 'D']], E=[[0, '-'], [0, '-'], [8, 'F']], F=[[0, '-'], [0, '-'], [0, '-']]) def __init__(self): self.state = 'A' def trim(self): if self.states[self.state][2][1] == '-': raise KeyError else: a = self.states[self.state][2][0] self.state = self.states[self.state][2][1] return a def fork(self): if self.states[self.state][1][1] == '-': raise KeyError else: a = self.states[self.state][1][0] self.state = self.states[self.state][1][1] return a def grow(self): if self.states[self.state][0][1] == '-': raise KeyError else: a = self.states[self.state][0][0] self.state = self.states[self.state][0][1] return a def main(): obj = FSM() return obj" "class MilesFSM: def __init__(self): self.state = 'A' def draw(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'E': self.state = 'F' return 6 elif self.state == 'G': self.state = 'E' return 9 elif self.state == 'D': self.state = 'E' return 3 else: raise KeyError def coast(self): if self.state == 'B': self.state = 'C' return 1 elif self.state == 'C': self.state = 'D' return 2 elif self.state == 'D': self.state = 'F' return 5 elif self.state == 'F': self.state = 'G' return 7 else: raise KeyError def trim(self): if self.state == 'F': self.state = 'B' return 8 if self.state == 'D': self.state = 'A' return 4 else: raise KeyError def main(): obj = MilesFSM() return obj" "class MilesFSM: def __init__(self): self.state = 'A' def paint(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'D': self.state = 'F' return 7 elif self.state == 'F': self.state = 'G' return 9 else: raise KeyError def link(self): if self.state == 'B': self.state = 'C' return 3 elif self.state == 'C': self.state = 'D' return 5 elif self.state == 'E': self.state = 'F' return 8 elif self.state == 'A': self.state = 'D' return 2 else: raise KeyError def peep(self): if self.state == 'B': self.state = 'F' return 4 elif self.state == 'D': self.state = 'E' return 6 elif self.state == 'A': self.state = 'E' return 1 else: raise KeyError def main(): obj = MilesFSM() return obj" "class StateMachine: state = 'A' def cue(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'D' return 4 else: raise KeyError def debug(self): if self.state == 'A': self.state = 'G' return 1 elif self.state == 'B': self.state = 'C' return 3 elif self.state == 'D': self.state = 'E' return 6 elif self.state == 'E': self.state = 'F' return 8 elif self.state == 'F': self.state = 'G' return 9 elif self.state == 'G': self.state = 'H' return 10 elif self.state == 'H': self.state = 'D' return 11 else: raise KeyError def zoom(self): if self.state == 'A': self.state = 'F' return 2 elif self.state == 'D': self.state = 'F' return 7 elif self.state == 'C': self.state = 'D' return 5 else: raise KeyError def main(): return StateMachine()" "class main: state = 'A' def __init__(self): self.state = 'A' def spin(self): match self.state: case 'A': self.state = 'B' return 0 case 'B': raise KeyError case 'C': self.state = 'D' return 2 case 'D': self.state = 'E' return 4 case 'E': self.state = 'F' return 5 case 'F': raise KeyError case 'G': self.state = 'C' return 8 case 'H': self.state = 'B' return 11 def clone(self): match self.state: case 'A': raise KeyError case 'B': self.state = 'C' return 1 case 'C': raise KeyError case 'D': raise KeyError case 'E': raise KeyError case 'F': raise KeyError case 'G': self.state = 'H' return 7 case 'H': self.state = 'F' return 10 def fork(self): match self.state: case 'A': raise KeyError case 'B': raise KeyError case 'C': self.state = 'E' return 3 case 'D': raise KeyError case 'E': raise KeyError case 'F': self.state = 'G' return 6 case 'G': return 9 case 'H': raise KeyError" "class Miles: def __init__(self): self._state = 'A' self._graph = {('A', 'sweep'): ('B', 0), ('B', 'sweep'): ('C', 1), ('B', 'reset'): ('D', 2), ('C', 'punch'): ('D', 3), ('C', 'sweep'): ('G', 4), ('D', 'sweep'): ('E', 5), ('D', 'leer'): ('G', 6), ('E', 'sweep'): ('F', 7), ('E', 'reset'): ('E', 8), ('F', 'reset'): ('G', 9), ('F', 'punch'): ('B', 10), ('G', 'punch'): ('H', 11)} def sweep(self): (self._state, ret_value) = self._graph[self._state, 'sweep'] return ret_value def punch(self): (self._state, ret_value) = self._graph[self._state, 'punch'] return ret_value def reset(self): (self._state, ret_value) = self._graph[self._state, 'reset'] return ret_value def leer(self): (self._state, ret_value) = self._graph[self._state, 'leer'] return ret_value def main(): return Miles() o = main()" "class main: def __init__(self): self.condition = 'A' def cast(self): if self.condition == 'A': self.condition = 'B' return 0 if self.condition == 'B': self.condition = 'C' return 2 if self.condition == 'D': self.condition = 'E' return 4 if self.condition == 'E': self.condition = 'F' return 6 raise KeyError def color(self): if self.condition == 'C': self.condition = 'D' return 3 if self.condition == 'D': self.condition = 'A' return 5 if self.condition == 'F': self.condition = 'G' return 8 raise KeyError def copy(self): if self.condition == 'E': self.condition = 'E' return 7 if self.condition == 'F': self.condition = 'F' return 9 if self.condition == 'A': self.condition = 'G' return 1 raise KeyError" "class main: state = 'A' def merge(self): return self.nextStep({'A': ['B', 0], 'C': ['D', 2], 'D': ['D', 5], 'E': ['F', 6], 'F': ['G', 8]}) def erase(self): return self.nextStep({'B': ['C', 1], 'C': ['C', 3], 'D': ['E', 4], 'E': ['E', 7], 'F': ['A', 9]}) def nextStep(self, transitions): output = transitions[self.state][1] self.state = transitions[self.state][0] return output" "class FSM: def __init__(self): self.A = 'A' self.B = 'B' self.C = 'C' self.D = 'D' self.E = 'E' self.F = 'F' self.start = self.A self.current_state = self.start def lower(self): if self.current_state == self.A: self.current_state = self.B return 0 elif self.current_state == self.E: self.current_state = self.C return 6 elif self.current_state == self.D: self.current_state = self.E return 4 elif self.current_state == self.F: self.current_state = self.F return 8 else: raise KeyError def chalk(self): if self.current_state == self.A: self.current_state = self.C return 1 elif self.current_state == self.E: self.current_state = self.F return 5 else: raise KeyError def move(self): if self.current_state == self.B: self.current_state = self.C return 2 elif self.current_state == self.E: self.current_state = self.B return 7 elif self.current_state == self.C: self.current_state = self.D return 3 else: raise KeyError def main(): evaluator = FSM() return evaluator" "def main(): class Main: def __init__(self): self.counter = None def drag(self): if self.counter is None: self.counter = 0 return self.counter elif self.counter == 1 or self.counter == 3 or self.counter == 7: self.counter = 4 return self.counter elif self.counter == 5 or self.counter == 8: self.counter = 6 return self.counter raise KeyError def look(self): if self.counter is None: self.counter = 1 return self.counter elif self.counter == 0: self.counter = 3 return self.counter elif self.counter == 5 or self.counter == 8: self.counter = 7 return self.counter elif self.counter == 2 or self.counter == 4: self.counter = 5 return self.counter raise KeyError def move(self): if self.counter is None: self.counter = 2 return self.counter elif self.counter == 5 or self.counter == 8: self.counter = 8 return self.counter raise KeyError return Main()" "class main: state = 'A' def scale(self): return self.nextStep({'A': ['B', 0], 'B': ['E', 3], 'F': ['B', 9], 'D': ['D', 6]}) def tweak(self): return self.nextStep({'B': ['C', 2], 'C': ['D', 4], 'D': ['E', 5], 'E': ['F', 7], 'F': ['G', 8], 'A': ['F', 1]}) def nextStep(self, transitions): output = transitions[self.state][1] self.state = transitions[self.state][0] return output" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class StateMachine: state = State.A def etch(self): return self.update({State.A: [State.B, 0], State.C: [State.A, 4], State.E: [State.G, 7], State.F: [State.F, 9]}) def mass(self): return self.update({State.B: [State.C, 2], State.A: [State.D, 1], State.C: [State.D, 3], State.D: [State.E, 5], State.E: [State.F, 6], State.F: [State.G, 8]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def skew(self): return self.update({State.A: [State.B, 0], State.C: [State.D, 3], State.E: [State.G, 6], State.F: [State.G, 7], State.H: [State.E, 11]}) def snap(self): return self.update({State.A: [State.C, 1], State.H: [State.B, 10]}) def scan(self): return self.update({State.B: [State.C, 2], State.E: [State.F, 5], State.F: [State.F, 8]}) def sort(self): return self.update({State.D: [State.E, 4], State.G: [State.H, 9]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class main: state = State.A def clear(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 2], State.C: [State.D, 3], State.D: [State.E, 4], State.E: [State.F, 6], State.F: [State.G, 8]}) def roam(self): return self.update({State.A: [State.C, 1], State.E: [State.A, 7], State.D: [State.B, 5], State.G: [State.G, 9]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal" "class main: def __init__(self): self.state = 'A' self.graph = {('A', 'speed'): ('B', 0), ('B', 'daub'): ('C', 1), ('B', 'speed'): ('G', 2), ('B', 'march'): ('F', 3), ('C', 'daub'): ('D', 4), ('D', 'march'): ('E', 5), ('E', 'speed'): ('F', 6), ('F', 'march'): ('G', 7), ('F', 'daub'): ('H', 8), ('G', 'speed'): ('H', 9), ('G', 'march'): ('A', 10), ('H', 'daub'): ('A', 11)} def speed(self): (self.state, ret) = self.graph[self.state, 'speed'] return ret def daub(self): (self.state, ret) = self.graph[self.state, 'daub'] return ret def march(self): (self.state, ret) = self.graph[self.state, 'march'] return ret" "class main: state = 'A' def paste(self): return self.nextA({'A': ['B', 0], 'D': ['E', 6], 'E': ['F', 8], 'B': ['F', 3], 'G': ['B', 11]}) def hike(self): return self.nextA({'B': ['C', 1], 'C': ['C', 5], 'D': ['F', 7], 'F': ['G', 9], 'G': ['H', 10]}) def etch(self): return self.nextA({'C': ['D', 4], 'B': ['E', 2]}) def nextA(self, transitions): output = transitions[self.state][1] self.state = transitions[self.state][0] return output" "import re class main: now_letter = 'A' dict_stop = {'A': '0B'} dict_shade = {'A': '2C', 'B': '4C', 'C': '5D', 'D': '6E', 'E': '7F'} dict_spin = {'A': '1D', 'E': '8E'} dict_stash = {'A': '3G', 'F': '9G'} def stop(self): temp_stop = self.now_letter if temp_stop in self.dict_stop: self.now_letter = re.findall('[A-Z]', self.dict_stop.get(temp_stop, 'KeyError'))[0] return int(re.findall('[0-9]+', self.dict_stop.get(temp_stop, 'KeyError'))[0]) else: raise KeyError def shade(self): temp_shade = self.now_letter if temp_shade in self.dict_shade: self.now_letter = re.findall('[A-Z]', self.dict_shade.get(temp_shade, 'KeyError'))[0] return int(re.findall('[0-9]+', self.dict_shade.get(temp_shade, 'KeyError'))[0]) else: raise KeyError def stash(self): temp_stash = self.now_letter if temp_stash in self.dict_stash: self.now_letter = re.findall('[A-Z]', self.dict_stash.get(temp_stash, 'KeyError'))[0] return int(re.findall('[0-9]+', self.dict_stash.get(temp_stash, 'KeyError'))[0]) else: raise KeyError def spin(self): temp_spin = self.now_letter if temp_spin in self.dict_spin: self.now_letter = re.findall('[A-Z]', self.dict_spin.get(temp_spin, 'KeyError'))[0] return int(re.findall('[0-9]+', self.dict_spin.get(temp_spin, 'KeyError'))[0]) else: raise KeyError" "class Mili: state = 'A' def fork(self): if self.state == 'A': self.state = 'A' return 2 elif self.state == 'E': self.state = 'F' return 7 elif self.state == 'H': self.state = 'E' return 11 else: raise KeyError def mask(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 3 elif self.state == 'C': self.state = 'D' return 4 elif self.state == 'D': self.state = 'E' return 5 elif self.state == 'F': self.state = 'G' return 8 else: raise KeyError def skew(self): if self.state == 'D': self.state = 'B' return 6 elif self.state == 'A': self.state = 'E' return 1 elif self.state == 'F': self.state = 'H' return 9 elif self.state == 'G': self.state = 'H' return 10 else: raise KeyError def main(): return Mili()" "class main: def __init__(self): self.__state = 'A' def check(self): if self.__state == 'A': self.__state = 'B' return 0 if self.__state == 'B': self.__state = 'C' return 1 if self.__state == 'D': self.__state = 'E' return 4 if self.__state == 'E': self.__state = 'F' return 6 raise KeyError def shade(self): if self.__state == 'B': return 2 if self.__state == 'C': self.__state = 'D' return 3 if self.__state == 'D': return 5 if self.__state == 'E': return 7 if self.__state == 'F': self.__state = 'C' return 8 raise KeyError" "class main: def __init__(self): self.point = 'A' def herd(self): if self.point == 'A': self.point = 'B' return 0 elif self.point == 'B': self.point = 'C' return 3 elif self.point == 'C': self.point = 'E' return 5 elif self.point == 'D': self.point = 'E' return 6 elif self.point == 'E': self.point = 'F' return 7 else: raise KeyError def turn(self): if self.point == 'C': self.point = 'D' return 4 elif self.point == 'A': self.point = 'F' return 2 elif self.point == 'G': self.point = 'H' return 9 elif self.point == 'H': self.point = 'H' return 10 else: raise KeyError def pluck(self): if self.point == 'A': self.point = 'H' return 1 elif self.point == 'F': self.point = 'G' return 8 elif self.point == 'H': self.point = 'D' return 11 else: raise KeyError" "from abc import ABC, abstractmethod class P(ABC): @abstractmethod def scan(self, current) -> int: pass @abstractmethod def pull(self, current) -> int: pass @abstractmethod def move(self, current) -> int: pass class A(P): def scan(self, current) -> int: current.current = B() return 0 def pull(self, current) -> int: current.current = D() return 1 def move(self, current) -> int: raise KeyError() class B(P): def scan(self, current) -> int: current.current = D() return 4 def pull(self, current) -> int: current.current = C() return 2 def move(self, current) -> int: current.current = F() return 3 class C(P): def scan(self, current) -> int: raise KeyError() def pull(self, current) -> int: raise KeyError() def move(self, current) -> int: current.current = D() return 5 class D(P): def scan(self, current) -> int: current.current = E() return 6 def pull(self, current) -> int: raise KeyError() def move(self, current) -> int: raise KeyError() class E(P): def scan(self, current) -> int: raise KeyError() def pull(self, current) -> int: current.current = G() return 8 def move(self, current) -> int: current.current = F() return 7 class F(P): def scan(self, current) -> int: raise KeyError() def pull(self, current) -> int: current.current = G() return 9 def move(self, current) -> int: raise KeyError() class G(P): def scan(self, current) -> int: pass def pull(self, current) -> int: pass def move(self, current) -> int: pass class FiniteStateMachine: def __init__(self) -> None: self.current = A() def scan(self) -> int: return self.current.scan(self) def pull(self) -> int: return self.current.pull(self) def move(self) -> int: return self.current.move(self) def main() -> FiniteStateMachine: return FiniteStateMachine()" "from __future__ import annotations from abc import ABC, abstractmethod class P(ABC): @abstractmethod def coast(self, current) -> int: pass @abstractmethod def push(self, current) -> int: pass @abstractmethod def chat(self, current) -> int: pass class A(P): def coast(self, current) -> int: current.current = B() return 0 def push(self, current) -> int: current.current = E() return 1 def chat(self, current) -> int: raise KeyError() class B(P): def coast(self, current) -> int: current.current = C() return 2 def push(self, current) -> int: raise KeyError() def chat(self, current) -> int: current.current = F() return 3 class C(P): def coast(self, current) -> int: current.current = E() return 5 def push(self, current) -> int: raise KeyError() def chat(self, current) -> int: current.current = D() return 4 class D(P): def coast(self, current) -> int: raise KeyError() def push(self, current) -> int: raise KeyError() def chat(self, current) -> int: current.current = E() return 6 class E(P): def coast(self, current) -> int: raise KeyError() def push(self, current) -> int: raise KeyError() def chat(self, current) -> int: current.current = F() return 7 class F(P): def coast(self, current) -> int: raise KeyError() def push(self, current) -> int: current.current = A() return 8 def chat(self, current) -> int: raise KeyError() class FiniteStateMachine: def __init__(self) -> None: self.current = A() def coast(self) -> int: return self.current.coast(self) def push(self) -> int: return self.current.push(self) def chat(self) -> int: return self.current.chat(self) def main() -> FiniteStateMachine: return FiniteStateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class StateMachine: state = State.A def swap(self): return self.update({State.A: [State.B, 0], State.B: [State.B, 2], State.C: [State.D, 3], State.D: [State.D, 6], State.E: [State.F, 7], State.F: [State.A, 9]}) def sweep(self): return self.update({State.B: [State.C, 1], State.C: [State.C, 4], State.D: [State.E, 5], State.F: [State.G, 8]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class Node: def __init__(self): self.data = None self.status = 'A' def tag(self): if self.status == 'B': self.data = 2 self.status = 'G' if self.status == 'A': self.data = 0 self.status = 'B' elif self.status == 'C': self.data = 3 self.status = 'D' elif self.status == 'D': self.data = 6 self.status = 'D' elif self.status == 'E': self.data = 8 self.status = 'E' elif self.status == 'F': self.data = 9 self.status = 'G' else: raise KeyError return self.data def peek(self): if self.status == 'B': self.data = 1 self.status = 'C' elif self.status == 'C': self.data = 4 self.status = 'E' elif self.status == 'D': self.data = 5 self.status = 'E' elif self.status == 'E': self.data = 7 self.status = 'F' else: raise KeyError return self.data def main(): return Node() o = main()" "class MilesFSM: def __init__(self): self.state = 'A' def crack(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 3 elif self.state == 'D': self.state = 'E' return 6 elif self.state == 'F': self.state = 'G' return 8 else: raise KeyError def cast(self): if self.state == 'A': self.state = 'C' return 1 elif self.state == 'F': self.state = 'B' return 9 elif self.state == 'G': self.state = 'H' return 10 elif self.state == 'H': self.state = 'C' return 11 else: raise KeyError def throw(self): if self.state == 'A': self.state = 'D' return 2 elif self.state == 'C': self.state = 'D' return 5 elif self.state == 'B': self.state = 'B' return 4 elif self.state == 'E': self.state = 'F' return 7 else: raise KeyError def main(): obj = MilesFSM() return obj" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def sit(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 1], State.D: [State.E, 5], State.E: [State.A, 8]}) def boost(self): return self.update({State.B: [State.B, 2], State.E: [State.E, 7]}) def exit(self): return self.update({State.C: [State.D, 4], State.E: [State.F, 6], State.B: [State.F, 3]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main: def __init__(self): self.point = 'A' def copy(self): if self.point == 'A': self.point = 'B' return 0 elif self.point == 'B': self.point = 'H' return 2 elif self.point == 'C': self.point = 'D' return 3 elif self.point == 'G': self.point = 'E' return 10 elif self.point == 'F': self.point = 'G' return 6 else: raise KeyError def chalk(self): if self.point == 'B': self.point = 'C' return 1 elif self.point == 'D': self.point = 'E' return 4 elif self.point == 'E': self.point = 'F' return 5 elif self.point == 'G': self.point = 'H' return 8 elif self.point == 'H': self.point = 'D' return 11 else: raise KeyError def slog(self): if self.point == 'F': self.point = 'H' return 7 elif self.point == 'G': self.point = 'B' return 9 else: raise KeyError" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def cut(self): return self.update({State.A: [State.B, 0], State.E: [State.F, 7], State.G: [State.D, 9]}) def shift(self): return self.update({State.A: [State.F, 1], State.B: [State.C, 3], State.D: [State.E, 5]}) def group(self): return self.update({State.A: [State.D, 2], State.C: [State.D, 4], State.D: [State.B, 6], State.F: [State.G, 8]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main: point = 'A' castdict = {'A': '0B', 'D': '4G', 'E': '6F'} filedict = {'B': '1C', 'C': '2D', 'D': '5F', 'E': '7E', 'F': '8G'} sitdict = {'D': '3E', 'G': '9G'} def cast(self): tmp_blame = self.point if self.castdict.get(tmp_blame, 'KeyError')[1] != 'e': self.point = self.castdict.get(tmp_blame, 'KeyError')[1] return int(self.castdict.get(tmp_blame)[0]) else: raise KeyError def file(self): tmp_blame = self.point if self.filedict.get(tmp_blame, 'KeyError')[1] != 'e': self.point = self.filedict.get(tmp_blame, 'KeyError')[1] return int(self.filedict.get(tmp_blame)[0]) else: raise KeyError def sit(self): tmp_drag = self.point if self.sitdict.get(tmp_drag, 'KeyError')[1] != 'e': self.point = self.sitdict.get(tmp_drag, 'KeyError')[1] return int(self.sitdict.get(tmp_drag)[0]) else: raise KeyError" "class main: def __init__(self): self.state = 'A' def build(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 2 elif self.state == 'E': self.state = 'B' return 8 elif self.state == 'D': self.state = 'A' return 6 else: raise KeyError def glare(self): if self.state == 'A': self.state = 'C' return 1 elif self.state == 'E': self.state = 'F' return 7 else: raise KeyError def cast(self): if self.state == 'B': self.state = 'F' return 3 elif self.state == 'C': self.state = 'D' return 4 elif self.state == 'D': self.state = 'E' return 5 else: raise KeyError" "class Milly: def __init__(self): self.current_state = 'A' self.PAINT = {'A': {'value': 0, 'new_state': 'B'}, 'B': {'value': 2, 'new_state': 'B'}, 'C': {'value': 4, 'new_state': 'C'}, 'E': {'value': 6, 'new_state': 'F'}, 'F': {'value': 8, 'new_state': 'G'}, 'G': {'value': 9, 'new_state': 'A'}} self.LOG = {'B': {'value': 1, 'new_state': 'C'}, 'C': {'value': 3, 'new_state': 'D'}, 'D': {'value': 5, 'new_state': 'E'}, 'E': {'value': 7, 'new_state': 'A'}} def paint(self): res = self.PAINT[self.current_state] self.current_state = res['new_state'] return res['value'] def log(self): res = self.LOG[self.current_state] self.current_state = res['new_state'] return res['value'] def main(): return Milly()" "class Mainly: def __init__(self): self.state = -1 def mute(self): if self.state == -1: self.state = 0 elif self.state == 7: self.state = 6 else: raise KeyError return self.state def add(self): if self.state == 0: self.state = 3 elif self.state == 3: self.state = 4 elif self.state == -1: self.state = 2 elif self.state == 5 or self.state == 6: self.state = 8 elif self.state == 2 or self.state == 9: self.state = 10 else: raise KeyError return self.state def brake(self): if self.state == 4 or self.state == 7: self.state = 7 else: raise KeyError return self.state def clone(self): if self.state == -1: self.state = 1 elif self.state == 3: self.state = 5 elif self.state == 1 or self.state == 8 or self.state == 11: self.state = 9 elif self.state == 10: self.state = 11 else: raise KeyError return self.state def main(): return Mainly()" "class M: def __init__(self): self.state = 'A' def throw(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 2 elif self.state == 'C': self.state = 'D' return 4 elif self.state == 'E': self.state = 'F' return 7 else: raise KeyError def file(self): if self.state == 'A': self.state = 'E' return 1 elif self.state == 'C': return 5 elif self.state == 'D': self.state = 'E' return 6 elif self.state == 'B': self.state = 'F' return 3 elif self.state == 'E': self.state = 'C' return 8 else: raise KeyError def main(): obj = M() return obj" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def forge(self): return self.update({State.A: [State.B, 0], State.D: [State.E, 3], State.E: [State.F, 5], State.G: [State.E, 7]}) def amble(self): return self.update({State.B: [State.C, 1], State.C: [State.D, 2], State.G: [State.G, 8]}) def pull(self): return self.update({State.D: [State.A, 4], State.F: [State.G, 6], State.G: [State.C, 9]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main: def __init__(self): self.__state = 'A' def crush(self): if self.__state == 'A': self.__state = 'B' return 0 if self.__state == 'B': self.__state = 'C' return 2 if self.__state == 'C': self.__state = 'D' return 5 raise KeyError def trim(self): if self.__state == 'C': self.__state = 'A' return 6 raise KeyError def throw(self): if self.__state == 'A': self.__state = 'E' return 1 if self.__state == 'B': self.__state = 'F' return 4 if self.__state == 'D': self.__state = 'E' return 8 raise KeyError def visit(self): if self.__state == 'B': return 3 if self.__state == 'E': self.__state = 'F' return 9 if self.__state == 'C': self.__state = 'G' return 7 if self.__state == 'F': self.__state = 'G' return 10 if self.__state == 'G': self.__state = 'H' return 11 raise KeyError" "class StateMachine: state = 'A' def chip(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'D': self.state = 'E' return 3 elif self.state == 'E': self.state = 'F' return 5 elif self.state == 'F': self.state = 'G' return 8 elif self.state == 'G': return 9 else: raise KeyError def warp(self): if self.state == 'B': self.state = 'C' return 1 elif self.state == 'C': self.state = 'D' return 2 elif self.state == 'D': self.state = 'G' return 4 elif self.state == 'E': return 6 else: raise KeyError def build(self): if self.state == 'E': self.state = 'C' return 7 else: raise KeyError def main(): return StateMachine()" "class main: def __init__(self): self.point = 'A' def unite(self): if self.point == 'A': self.point = 'B' return 0 elif self.point == 'B': self.point = 'B' return 2 elif self.point == 'C': self.point = 'D' return 3 elif self.point == 'F': self.point = 'A' return 6 else: raise KeyError def tag(self): if self.point == 'D': self.point = 'E' return 4 elif self.point == 'E': self.point = 'F' return 5 elif self.point == 'F': self.point = 'F' return 8 else: raise KeyError def trace(self): if self.point == 'B': self.point = 'C' return 1 elif self.point == 'F': self.point = 'C' return 7 else: raise KeyError" "def main(): class Main: def __init__(self): self.counter = None def trash(self): if self.counter is None: self.counter = 0 return self.counter elif self.counter == 1: self.counter = 5 return self.counter elif self.counter == 2: self.counter = 6 return self.counter elif self.counter == 1 or self.counter == 5 or self.counter == 7: self.counter = 9 return self.counter raise KeyError def drive(self): if self.counter == 0: self.counter = 2 return self.counter elif self.counter == 6: self.counter = 8 return self.counter elif self.counter == 8 or self.counter == 9: self.counter = 10 return self.counter raise KeyError def move(self): if self.counter is None: self.counter = 1 return self.counter elif self.counter == 0: self.counter = 3 return self.counter elif self.counter == 4 or self.counter == 10: self.counter = 11 return self.counter raise KeyError def clone(self): if self.counter == 0: self.counter = 4 return self.counter elif self.counter == 6: self.counter = 7 return self.counter raise KeyError return Main()" "class main: state = 'A' def align(self): dict = {'A': [0, 'B'], 'B': [3, 'B'], 'C': KeyError, 'D': KeyError, 'E': [7, 'F'], 'F': KeyError} for (key, value) in dict.items(): if key == self.state: if value == KeyError: raise KeyError else: self.state = value[1] return value[0] def mask(self): dict = {'A': [1, 'E'], 'B': [2, 'C'], 'C': [5, 'D'], 'D': [6, 'E'], 'E': KeyError, 'F': [8, 'C']} for (key, value) in dict.items(): if key == self.state: if value == KeyError: raise KeyError else: self.state = value[1] return value[0] def erase(self): dict = {'A': KeyError, 'B': [4, 'D'], 'C': KeyError, 'D': KeyError, 'E': KeyError, 'F': KeyError} for (key, value) in dict.items(): if key == self.state: if value == KeyError: raise KeyError else: self.state = value[1] return value[0]" "def f9(): class StateMachine: state = 'A' def pose(self): match self.state: case 'A': self.state = 'B' return 0 case 'B': self.state = 'C' return 1 case 'C': return 3 case 'D': self.state = 'E' return 4 case 'E': self.state = 'B' return 7 case 'F': self.state = 'A' return 8 raise KeyError() def etch(self): match self.state: case 'C': self.state = 'D' return 2 case 'D': self.state = 'B' return 5 case 'E': self.state = 'F' return 6 raise KeyError() return StateMachine() def main(): return f9()" "class main: def __init__(self): self.condition = 'A' def trace(self): if self.condition == 'A': self.condition = 'B' return 0 elif self.condition == 'D': self.condition = 'A' return 6 else: raise KeyError def daub(self): if self.condition == 'B': self.condition = 'C' return 1 elif self.condition == 'D': self.condition = 'B' return 5 elif self.condition == 'E': self.condition = 'A' return 8 else: raise KeyError def fade(self): if self.condition == 'C': self.condition = 'D' return 3 elif self.condition == 'D': self.condition = 'E' return 4 elif self.condition == 'E': self.condition = 'F' return 7 elif self.condition == 'B': self.condition = 'F' return 2 else: raise KeyError" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class main: state = State.A def load(self): return self.update({State.A: [State.B, 0], State.C: [State.A, 3], State.D: [State.E, 5], State.E: [State.F, 7]}) def lower(self): return self.update({State.B: [State.C, 1], State.D: [State.A, 6], State.E: [State.A, 8], State.C: [State.D, 2]}) def view(self): return self.update({State.C: [State.C, 4]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class StateMachine: state = State.A def cue(self): return self.update({State.A: [State.B, 0], State.D: [State.E, 4], State.E: [State.F, 5], State.F: [State.C, 8]}) def visit(self): return self.update({State.A: [State.A, 1], State.F: [State.A, 7], State.G: [State.G, 9]}) def coast(self): return self.update({State.B: [State.C, 2], State.C: [State.D, 3], State.F: [State.G, 6]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main: def __init__(self): self.point = 'A' def pose(self): if self.point == 'A': self.point = 'B' return 0 elif self.point == 'G': self.point = 'B' return 9 elif self.point == 'D': self.point = 'E' return 4 elif self.point == 'E': self.point = 'F' return 5 elif self.point == 'F': self.point = 'G' return 7 else: raise KeyError def brake(self): if self.point == 'B': self.point = 'C' return 2 elif self.point == 'C': self.point = 'D' return 3 elif self.point == 'E': self.point = 'E' return 6 elif self.point == 'G': self.point = 'D' return 8 elif self.point == 'A': self.point = 'F' return 1 else: raise KeyError" "class Mili: def __init__(self): self.condition = 'A' def exit(self): if self.condition in ['A', 'B', 'D', 'E']: if self.condition in ['A', 'B']: if self.condition == 'A': self.condition = 'C' return 1 else: self.condition = 'C' return 2 elif self.condition == 'D': self.condition = 'A' return 5 else: self.condition = 'A' return 7 else: raise KeyError def begin(self): if self.condition in ['A', 'C', 'D', 'E', 'F']: if self.condition in ['A', 'C', 'D']: if self.condition in ['A', 'C']: if self.condition == 'A': self.condition = 'B' return 0 else: self.condition = 'D' return 3 else: self.condition = 'E' return 4 elif self.condition == 'E': self.condition = 'F' return 6 else: return 8 else: raise KeyError def main(): return Mili()" "class Miles_FSM: def __init__(self): self.state = 'A' def visit(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'G' return 2 elif self.state == 'F': self.state = 'C' return 8 else: raise KeyError def merge(self): if self.state == 'B': self.state = 'C' return 1 elif self.state == 'C': self.state = 'A' return 4 elif self.state == 'F': self.state = 'D' return 9 else: raise KeyError def click(self): if self.state == 'C': self.state = 'D' return 3 elif self.state == 'D': self.state = 'E' return 5 elif self.state == 'E': self.state = 'F' return 6 elif self.state == 'F': self.state = 'G' return 7 else: raise KeyError def main(): obj = Miles_FSM() return obj" "class Milli: def __init__(self): self.sost = 'A' def sway(self): if self.sost == 'A': self.sost = 'B' return 0 elif self.sost == 'C': self.sost = 'D' return 2 elif self.sost == 'D': self.sost = 'E' return 5 else: raise KeyError def pluck(self): if self.sost == 'B': self.sost = 'C' return 1 elif self.sost == 'C': self.sost = 'E' return 3 elif self.sost == 'E': self.sost = 'F' return 7 else: raise KeyError def dash(self): if self.sost == 'D': self.sost = 'D' return 6 elif self.sost == 'C': self.sost = 'F' return 4 elif self.sost == 'E': self.sost = 'B' return 8 else: raise KeyError def main(): return Milli()" "class Miles_FSM: def __init__(self): self.state = 'A' def align(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 3 elif self.state == 'C': self.state = 'D' return 4 elif self.state == 'F': self.state = 'G' return 7 elif self.state == 'G': self.state = 'C' return 10 else: raise KeyError def open(self): if self.state == 'A': self.state = 'C' return 1 elif self.state == 'D': self.state = 'E' return 5 elif self.state == 'H': self.state = 'B' return 11 else: raise KeyError def widen(self): if self.state == 'A': self.state = 'D' return 2 elif self.state == 'F': self.state = 'H' return 8 else: raise KeyError def bolt(self): if self.state == 'E': self.state = 'F' return 6 elif self.state == 'G': self.state = 'H' return 9 else: raise KeyError def main(): obj = Miles_FSM() return obj" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class StateMachine: state = State.A def pull(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 1], State.C: [State.E, 4], State.E: [State.F, 6], State.F: [State.B, 7]}) def move(self): return self.update({State.C: [State.D, 3], State.B: [State.E, 2], State.D: [State.E, 5], State.F: [State.D, 8]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main: def __init__(self): self.condition = 'A' def group(self): if self.condition == 'A': self.condition = 'B' return 0 elif self.condition == 'B': self.condition = 'C' return 2 elif self.condition == 'E': self.condition = 'F' return 5 elif self.condition == 'G': self.condition = 'D' return 9 elif self.condition == 'F': self.condition = 'G' return 7 else: raise KeyError def model(self): if self.condition == 'A': self.condition = 'D' return 1 elif self.condition == 'F': self.condition = 'A' return 8 elif self.condition == 'C': self.condition = 'D' return 3 elif self.condition == 'D': self.condition = 'E' return 4 elif self.condition == 'E': self.condition = 'C' return 6 else: raise KeyError" "class A: state = 'A' def crush(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'C': self.state = 'E' return 6 elif self.state == 'D': self.state = 'E' return 7 elif self.state == 'E': self.state = 'F' return 8 else: raise KeyError def scan(self): if self.state == 'A': self.state = 'F' return 1 elif self.state == 'F': self.state = 'B' return 3 elif self.state == 'C': self.state = 'D' return 4 else: raise KeyError def make(self): if self.state == 'B': self.state = 'C' return 2 if self.state == 'C': self.state = 'A' return 5 else: raise KeyError def main(): return A()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class StateMachine: state = State.A def look(self): return self.update({State.A: [State.B, 0], State.C: [State.D, 2], State.E: [State.C, 6]}) def fetch(self): return self.update({State.B: [State.C, 1], State.E: [State.F, 5], State.F: [State.G, 8], State.G: [State.G, 9]}) def erase(self): return self.update({State.C: [State.C, 3], State.D: [State.E, 4], State.E: [State.G, 7]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class StateMachine: state = State.A def shift(self): return self.update({State.A: [State.B, 0], State.C: [State.E, 3], State.D: [State.E, 4], State.F: [State.G, 8], State.E: [State.E, 7]}) def brake(self): return self.update({State.B: [State.C, 1], State.D: [State.A, 5], State.C: [State.D, 2], State.E: [State.F, 6], State.G: [State.G, 9]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main: def __init__(self): self.condition = 'A' def pan(self): if self.condition == 'A': self.condition = 'B' return 0 elif self.condition == 'C': self.condition = 'D' return 3 elif self.condition == 'D': self.condition = 'F' return 6 elif self.condition == 'E': self.condition = 'F' return 7 elif self.condition == 'F': self.condition = 'G' return 9 elif self.condition == 'G': self.condition = 'A' return 11 else: raise KeyError def sit(self): if self.condition == 'A': self.condition = 'D' return 1 elif self.condition == 'B': self.condition = 'C' return 2 elif self.condition == 'C': self.condition = 'A' return 4 elif self.condition == 'D': self.condition = 'E' return 5 elif self.condition == 'E': self.condition = 'E' return 8 elif self.condition == 'G': self.condition = 'H' return 10 else: raise KeyError" "class Machine: state = 'A' def load(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 2 elif self.state == 'C': self.state = 'D' return 5 elif self.state == 'D': self.state = 'E' return 7 else: raise KeyError def fade(self): if self.state == 'A': self.state = 'F' return 1 elif self.state == 'B': self.state = 'H' return 3 elif self.state == 'E': self.state = 'F' return 8 elif self.state == 'G': self.state = 'H' return 10 elif self.state == 'H': self.state = 'F' return 11 else: raise KeyError def hike(self): if self.state == 'B': self.state = 'E' return 4 elif self.state == 'C': self.state = 'E' return 6 elif self.state == 'F': self.state = 'G' return 9 else: raise KeyError def main(): return Machine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def tread(self): return self.update({State.A: [State.B, 0], State.D: [State.E, 4], State.E: [State.F, 7]}) def punch(self): return self.update({State.A: [State.F, 1], State.B: [State.C, 2], State.C: [State.D, 3], State.D: [State.H, 5], State.E: [State.H, 8], State.G: [State.B, 11]}) def color(self): return self.update({State.D: [State.A, 6], State.F: [State.G, 9], State.G: [State.H, 10]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main: def __init__(self): self.cur_state = 'A' def scale(self): if self.cur_state == 'A': self.cur_state = 'B' return 0 elif self.cur_state == 'B': self.cur_state = 'C' return 1 elif self.cur_state == 'C': self.cur_state = 'D' return 3 elif self.cur_state == 'D': self.cur_state = 'E' return 5 elif self.cur_state == 'E': self.cur_state = 'G' return 9 else: raise KeyError def paint(self): if self.cur_state == 'B': self.cur_state = 'E' return 2 elif self.cur_state == 'E': self.cur_state = 'H' return 8 elif self.cur_state == 'C': self.cur_state = 'G' return 4 else: raise KeyError def turn(self): if self.cur_state == 'D': self.cur_state = 'F' return 6 elif self.cur_state == 'E': self.cur_state = 'F' return 7 elif self.cur_state == 'F': self.cur_state = 'G' return 10 elif self.cur_state == 'G': self.cur_state = 'H' return 11 else: raise KeyError" "class main: def __init__(self): self.state = 'A' self.status = 0 def find(self, dic): if self.state in dic.keys(): self.status = dic[self.state][1] self.state = dic[self.state][0] return self.status raise KeyError def align(self): return self.find({'A': ['B', 0], 'C': ['E', 4], 'D': ['E', 5], 'E': ['F', 7]}) def skew(self): return self.find({'B': ['C', 2], 'C': ['D', 3], 'A': ['D', 1], 'D': ['D', 6], 'F': ['D', 8]})" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class StateMachine: state = State.A def color(self): return self.update({State.A: [State.A, 1], State.E: [State.B, 6], State.F: [State.G, 8]}) def order(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 2], State.E: [State.C, 7]}) def show(self): return self.update({State.C: [State.D, 3], State.D: [State.E, 4], State.E: [State.F, 5], State.G: [State.G, 9]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def cue(self): return self.update({State.A: [State.B, 0], State.C: [State.D, 2], State.D: [State.E, 3], State.E: [State.F, 5], State.F: [State.G, 6], State.G: [State.H, 8], State.H: [State.C, 11]}) def clean(self): return self.update({State.B: [State.C, 1], State.D: [State.A, 4], State.F: [State.B, 7], State.G: [State.E, 9], State.H: [State.F, 10]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def send(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 3], State.C: [State.D, 4], State.D: [State.B, 6]}) def bend(self): return self.update({State.A: [State.F, 1], State.G: [State.H, 9], State.H: [State.H, 11]}) def stare(self): return self.update({State.A: [State.G, 2], State.D: [State.E, 5], State.E: [State.F, 7], State.F: [State.G, 8], State.G: [State.G, 10]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class StateMachine: state = State.A def init(self): return self.update({State.A: [State.B, 0], State.D: [State.B, 5], State.E: [State.C, 7]}) def send(self): return self.update({State.B: [State.C, 1], State.D: [State.D, 4], State.E: [State.F, 6], State.F: [State.F, 8]}) def skip(self): return self.update({State.C: [State.D, 2], State.D: [State.E, 3]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class Machine: state = 'A' def amble(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': return 3 elif self.state == 'C': self.state = 'A' return 5 elif self.state == 'F': self.state = 'G' return 8 else: raise KeyError def peep(self): if self.state == 'A': self.state = 'E' return 1 elif self.state == 'B': self.state = 'C' return 2 elif self.state == 'C': self.state = 'D' return 4 elif self.state == 'D': self.state = 'E' return 6 elif self.state == 'E': self.state = 'F' return 7 elif self.state == 'F': self.state = 'C' return 9 else: raise KeyError def main(): return Machine()" "class main: def __init__(self): self.status = 'A' def split(self): match self.status: case 'A': self.status = 'B' return 0 case 'C': self.status = 'F' return 4 case 'D': self.status = 'E' return 5 case 'E': self.status = 'F' return 6 case _: raise KeyError def skid(self): match self.status: case 'B': self.status = 'C' return 2 case 'C': self.status = 'D' return 3 case 'E': self.status = 'A' return 8 case _: raise KeyError def join(self): match self.status: case 'E': self.status = 'C' return 7 case 'A': self.status = 'F' return 1 case _: raise KeyError" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class StateMachine: state = State.A def pose(self): return self.update({State.A: [State.B, 0], State.C: [State.E, 5], State.E: [State.F, 7]}) def view(self): return self.update({State.A: [State.D, 1], State.B: [State.C, 2], State.C: [State.D, 3], State.D: [State.E, 6]}) def chain(self): return self.update({State.C: [State.C, 4], State.F: [State.F, 8]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class StateMachine: state = State.A def hoard(self): return self.update({State.A: [State.B, 0], State.C: [State.D, 3], State.F: [State.C, 8]}) def spawn(self): return self.update({State.B: [State.C, 1], State.E: [State.F, 6], State.F: [State.F, 7]}) def scan(self): return self.update({State.B: [State.F, 2], State.C: [State.E, 4], State.D: [State.E, 5]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def look(self): return self.update({State.A: [State.B, 0], State.D: [State.E, 5], State.E: [State.F, 6], State.C: [State.H, 4]}) def paste(self): return self.update({State.E: [State.B, 7], State.G: [State.H, 10], State.H: [State.H, 11]}) def stall(self): return self.update({State.B: [State.C, 1], State.C: [State.E, 3]}) def pull(self): return self.update({State.C: [State.D, 2], State.E: [State.H, 8], State.F: [State.G, 9]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class main: state = State.A def shade(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 1], State.G: [State.H, 9]}) def join(self): return self.update({State.D: [State.E, 5], State.G: [State.A, 11]}) def stay(self): return self.update({State.C: [State.G, 4], State.E: [State.B, 7], State.G: [State.G, 10]}) def edit(self): return self.update({State.B: [State.F, 2], State.C: [State.D, 3], State.E: [State.F, 6], State.F: [State.G, 8]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class StateMachine: state = State.A def peek(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 2], State.C: [State.D, 3], State.D: [State.A, 6], State.E: [State.F, 7]}) def sort(self): return self.update({State.A: [State.F, 1], State.C: [State.F, 4], State.D: [State.E, 5], State.E: [State.B, 8]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class main: state = State.A def loop(self): return self.update({State.A: [State.H, 1], State.B: [State.H, 3], State.C: [State.D, 4], State.D: [State.E, 5], State.E: [State.B, 7], State.F: [State.G, 8], State.G: [State.C, 10]}) def rock(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 2], State.G: [State.D, 11]}) def open(self): return self.update({State.E: [State.F, 6], State.G: [State.H, 9]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal" "class main: def __init__(self): self.__state = 'A' def crush(self): if self.__state == 'A': self.__state = 'B' return 0 if self.__state == 'B': self.__state = 'E' return 4 if self.__state == 'C': self.__state = 'E' return 6 if self.__state == 'D': self.__state = 'E' return 7 if self.__state == 'E': self.__state = 'F' return 8 raise KeyError def edit(self): if self.__state == 'A': self.__state = 'D' return 1 if self.__state == 'B': self.__state = 'C' return 2 if self.__state == 'F': self.__state = 'G' return 9 raise KeyError def rock(self): if self.__state == 'B': self.__state = 'F' return 3 if self.__state == 'C': self.__state = 'D' return 5 raise KeyError" "class main: def __init__(self): self.condition = 'A' def skid(self): if self.condition == 'A': self.condition = 'B' return 0 elif self.condition == 'B': self.condition = 'C' return 1 elif self.condition == 'C': self.condition = 'F' return 3 elif self.condition == 'F': self.condition = 'B' return 8 elif self.condition == 'D': self.condition = 'D' return 5 else: raise KeyError def hike(self): if self.condition == 'F': self.condition = 'A' return 7 elif self.condition == 'C': self.condition = 'D' return 2 elif self.condition == 'D': self.condition = 'E' return 4 elif self.condition == 'E': self.condition = 'F' return 6 else: raise KeyError" "class main: def __init__(self): self.state = 'A' def crack(self): if self.state == 'A': self.state = 'B' return 0 if self.state == 'D': self.state = 'E' return 5 if self.state == 'E': self.state = 'F' return 7 if self.state == 'G': self.state = 'B' return 10 raise KeyError def play(self): if self.state == 'A': self.state = 'E' return 1 if self.state == 'B': self.state = 'C' return 2 if self.state == 'C': self.state = 'D' return 3 if self.state == 'D': self.state = 'F' return 6 if self.state == 'G': self.state = 'D' return 11 if self.state == 'F': self.state = 'G' return 8 raise KeyError def fork(self): if self.state == 'C': self.state = 'G' return 4 if self.state == 'G': self.state = 'H' return 9 raise KeyError" "class main: def __init__(self): self.name = 'A' def wreck(self): if self.name == 'A': self.name = 'B' return 0 elif self.name == 'B': self.name = 'C' return 1 elif self.name == 'C': self.name = 'D' return 2 elif self.name == 'D': self.name = 'F' return 5 elif self.name == 'E': self.name = 'F' return 6 else: raise KeyError def load(self): if self.name == 'C': self.name = 'A' return 3 elif self.name == 'D': self.name = 'E' return 4 elif self.name == 'E': return 7 elif self.name == 'F': return 8 else: raise KeyError" "class State: current_state = 20 def update(obj={}): fun_state = State.current_state State.current_state = obj[State.current_state] return obj[fun_state] class main: def cut(self): result = State.update(obj={20: 0, 2: 3, 1: 3, 3: 4, 4: 5, 5: 8, 6: 9, 7: 9, 9: 11, 11: 0, 10: 4, 8: 4}) return result def etch(self): result = State.update(obj={20: 1, 0: 2, 4: 6, 5: 7, 7: 10, 6: 10, 11: 1}) return result" "class StateMachine: state = 'A' def leer(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'F' return 3 elif self.state == 'C': self.state = 'D' return 4 elif self.state == 'D': self.state = 'E' return 6 elif self.state == 'E': self.state = 'F' return 7 elif self.state == 'F': self.state = 'G' return 8 else: raise KeyError def run(self): if self.state == 'A': self.state = 'D' return 1 elif self.state == 'B': self.state = 'C' return 2 elif self.state == 'C': self.state = 'A' return 5 elif self.state == 'F': self.state = 'C' return 9 else: raise KeyError def main(): return StateMachine()" "class main: state = 'a' def color(self): return self.nextStep({'a': ['b', 0], 'c': ['d', 2], 'd': ['f', 5], 'e': ['f', 6], 'h': ['d', 11]}) def hike(self): return self.nextStep({'b': ['c', 1], 'c': ['e', 3], 'd': ['e', 4], 'e': ['h', 7], 'f': ['g', 8], 'g': ['h', 9], 'h': ['c', 10]}) def nextStep(self, ways): signal = ways[self.state][1] self.state = ways[self.state][0] return signal" "class main: state = 'a' def visit(self): return self.nextStep({'a': ['b', 0], 'e': ['b', 6]}) def cue(self): return self.nextStep({'b': ['c', 1], 'c': ['d', 2], 'd': ['e', 4], 'f': ['f', 8]}) def cast(self): return self.nextStep({'c': ['c', 3], 'e': ['f', 5], 'f': ['c', 7]}) def nextStep(self, ways): signal = ways[self.state][1] self.state = ways[self.state][0] return signal" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def pan(self): return self.update({State.A: [State.B, 0], State.C: [State.D, 4], State.F: [State.G, 8]}) def clone(self): return self.update({State.A: [State.C, 1], State.B: [State.C, 3], State.E: [State.F, 6], State.G: [State.G, 9]}) def build(self): return self.update({State.A: [State.D, 2], State.D: [State.E, 5], State.E: [State.E, 7]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main: def __init__(self): self.__state = 'A' def rig(self): if self.__state == 'A': self.__state = 'B' return 0 if self.__state == 'B': self.__state = 'C' return 1 if self.__state == 'C': return 5 if self.__state == 'D': self.__state = 'F' return 7 if self.__state == 'E': self.__state = 'F' return 8 raise KeyError def glare(self): if self.__state == 'B': return 2 if self.__state == 'C': self.__state = 'F' return 4 if self.__state == 'F': self.__state = 'G' return 9 if self.__state == 'G': self.__state = 'H' return 10 raise KeyError def tread(self): if self.__state == 'C': self.__state = 'D' return 3 if self.__state == 'D': self.__state = 'E' return 6 if self.__state == 'G': self.__state = 'C' return 11 raise KeyError" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def play(self): return self.update({State.A: [State.B, 0], State.C: [State.G, 4], State.D: [State.E, 6]}) def tag(self): return self.update({State.C: [State.D, 2], State.F: [State.B, 9], State.G: [State.H, 10]}) def forge(self): return self.update({State.C: [State.E, 3], State.F: [State.G, 8]}) def stash(self): return self.update({State.B: [State.C, 1], State.C: [State.H, 5], State.E: [State.F, 7], State.G: [State.E, 11]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class StateMachine: state = State.A def lower(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 1], State.D: [State.E, 5], State.C: [State.G, 4], State.E: [State.F, 7], State.F: [State.G, 8]}) def amass(self): return self.update({State.B: [State.D, 2], State.C: [State.D, 3], State.D: [State.D, 6], State.G: [State.A, 9]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class Mili: state = 'A' def boost(self): if self.state == 'A': self.state = 'C' return 2 elif self.state == 'B': self.state = 'F' return 4 else: raise KeyError def bolt(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'D': self.state = 'E' return 6 elif self.state == 'E': self.state = 'F' return 7 else: raise KeyError def split(self): if self.state == 'A': self.state = 'D' return 1 elif self.state == 'B': self.state = 'C' return 3 elif self.state == 'C': self.state = 'D' return 5 elif self.state == 'F': self.state = 'F' return 8 else: raise KeyError def main(): return Mili()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class main: state = State.A def forge(self): return self.update({State.A: [State.B, 0], State.B: [State.E, 3], State.C: [State.D, 5]}) def daub(self): return self.update({State.A: [State.A, 1], State.B: [State.B, 4], State.D: [State.E, 7], State.E: [State.F, 8]}) def add(self): return self.update({State.B: [State.C, 2], State.C: [State.A, 6]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def apply(self): return self.update({State.A: [State.B, 0], State.E: [State.B, 7]}) def get(self): return self.update({State.B: [State.C, 1], State.D: [State.F, 5], State.E: [State.E, 8]}) def cut(self): return self.update({State.B: [State.D, 2], State.C: [State.D, 3], State.D: [State.E, 4], State.E: [State.F, 6]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def hurry(self): return self.update({State.A: [State.A, 1], State.B: [State.C, 2], State.E: [State.F, 6], State.F: [State.C, 9], State.H: [State.F, 11]}) def swap(self): return self.update({State.A: [State.B, 0], State.B: [State.G, 3], State.C: [State.D, 4], State.D: [State.E, 5], State.E: [State.B, 7], State.F: [State.G, 8], State.G: [State.H, 10]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class MilesFSM: def __init__(self): self.state = 'A' def begin(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 1 elif self.state == 'E': self.state = 'H' return 6 elif self.state == 'F': self.state = 'G' return 7 elif self.state == 'G': self.state = 'H' return 9 else: raise KeyError def clean(self): if self.state == 'C': self.state = 'D' return 2 elif self.state == 'E': self.state = 'C' return 5 elif self.state == 'D': self.state = 'E' return 3 elif self.state == 'G': self.state = 'D' return 10 else: raise KeyError def skip(self): if self.state == 'G': self.state = 'A' return 11 elif self.state == 'E': self.state = 'F' return 4 elif self.state == 'F': self.state = 'C' return 8 else: raise KeyError def main(): obj = MilesFSM() return obj" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class StateMachine: state = State.A def copy(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 1], State.C: [State.F, 3], State.F: [State.D, 9]}) def link(self): return self.update({State.C: [State.D, 2], State.D: [State.E, 5], State.F: [State.G, 7]}) def model(self): return self.update({State.C: [State.G, 4], State.E: [State.F, 6], State.F: [State.B, 8]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main: def __init__(self): self.state = 'A' def wreck(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'D': self.state = 'G' return 5 elif self.state == 'G': self.state = 'E' return 9 elif self.state == 'E': self.state = 'F' return 6 elif self.state == 'F': self.state = 'G' return 7 else: raise KeyError def mask(self): if self.state == 'B': self.state = 'C' return 2 elif self.state == 'C': self.state = 'D' return 3 elif self.state == 'F': self.state = 'D' return 8 else: raise KeyError def color(self): if self.state == 'D': self.state = 'E' return 4 elif self.state == 'A': self.state = 'F' return 1 else: raise KeyError" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def paste(self): return self.update({State.A: [State.B, 0], State.F: [State.D, 8]}) def speed(self): return self.update({State.B: [State.C, 2], State.C: [State.D, 3], State.D: [State.E, 4], State.E: [State.F, 5], State.H: [State.F, 11], State.A: [State.H, 1], State.F: [State.A, 9]}) def rig(self): return self.update({State.E: [State.H, 6], State.F: [State.G, 7], State.G: [State.H, 10]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main: def __init__(self): self.point = 'A' def cull(self): if self.point == 'A': self.point = 'A' return 1 elif self.point == 'H': self.point = 'H' return 11 elif self.point == 'D': self.point = 'E' return 5 elif self.point == 'G': self.point = 'H' return 9 else: raise KeyError def paint(self): if self.point == 'A': self.point = 'B' return 0 elif self.point == 'C': self.point = 'D' return 4 elif self.point == 'E': self.point = 'C' return 7 elif self.point == 'G': self.point = 'D' return 10 else: raise KeyError def fork(self): if self.point == 'A': self.point = 'F' return 2 elif self.point == 'B': self.point = 'C' return 3 elif self.point == 'E': self.point = 'F' return 6 elif self.point == 'F': self.point = 'G' return 8 else: raise KeyError" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def add(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 1], State.D: [State.E, 5], State.E: [State.F, 7], State.C: [State.G, 4], State.F: [State.G, 9], State.H: [State.A, 11]}) def fill(self): return self.update({State.C: [State.D, 3], State.D: [State.B, 6], State.E: [State.E, 8], State.G: [State.H, 10], State.B: [State.H, 2]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main: def __init__(self): self.status = 'A' def model(self): match self.status: case 'A': self.status = 'B' return 0 case 'B': self.status = 'B' return 2 case 'C': self.status = 'D' return 3 case 'H': self.status = 'D' return 11 case 'F': self.status = 'G' return 7 case 'E': self.status = 'E' return 6 case _: raise KeyError def mix(self): match self.status: case 'B': self.status = 'C' return 1 case 'D': self.status = 'E' return 4 case 'F': self.status = 'F' return 8 case 'E': self.status = 'F' return 5 case _: raise KeyError def forge(self): match self.status: case 'F': self.status = 'C' return 9 case 'G': self.status = 'H' return 10 case _: raise KeyError" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class StateMachine: state = State.A def fill(self): return self.update({State.A: [State.B, 0], State.B: [State.B, 4], State.E: [State.F, 7]}) def view(self): return self.update({State.A: [State.A, 1], State.B: [State.C, 3], State.C: [State.D, 5], State.D: [State.E, 6], State.F: [State.F, 8]}) def peek(self): return self.update({State.A: [State.E, 3]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main: def __init__(self): self.point = 'A' def scan(self): if self.point == 'A': self.point = 'B' return 0 elif self.point == 'B': self.point = 'E' return 2 elif self.point == 'C': self.point = 'D' return 3 elif self.point == 'H': self.point = 'E' return 11 elif self.point == 'G': self.point = 'H' return 9 elif self.point == 'E': self.point = 'F' return 6 else: raise KeyError def coast(self): if self.point == 'B': self.point = 'C' return 1 elif self.point == 'C': self.point = 'C' return 4 elif self.point == 'H': self.point = 'C' return 10 elif self.point == 'F': self.point = 'G' return 8 elif self.point == 'E': self.point = 'E' return 7 elif self.point == 'D': self.point = 'E' return 5 else: raise KeyError" "class Mili: def __init__(self, state): self.state = state def tread(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 1 elif self.state == 'C': self.state = 'D' return 3 elif self.state == 'D': self.state = 'E' return 5 elif self.state == 'F': self.state = 'A' return 8 else: raise KeyError def swap(self): if self.state == 'B': self.state = 'E' return 2 elif self.state == 'C': self.state = 'F' return 4 elif self.state == 'E': self.state = 'F' return 6 elif self.state == 'F': self.state = 'G' return 7 elif self.state == 'G': self.state = 'D' return 9 else: raise KeyError def main(): return Mili('A')" "class MilesFMS: def __init__(self): self.state = 'A' def dash(self): if self.state == 'A': self.state = 'A' return 1 elif self.state == 'B': self.state = 'D' return 3 elif self.state == 'C': self.state = 'G' return 5 elif self.state == 'E': self.state = 'F' return 7 elif self.state == 'F': self.state = 'G' return 8 elif self.state == 'G': self.state = 'H' return 10 else: raise KeyError def skip(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 2 elif self.state == 'C': self.state = 'D' return 4 elif self.state == 'D': self.state = 'E' return 6 elif self.state == 'F': self.state = 'A' return 9 elif self.state == 'G': self.state = 'G' return 11 else: raise KeyError def main(): obj = MilesFMS() return obj" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def look(self): return self.update({State.A: [State.B, 0], State.D: [State.E, 4], State.F: [State.D, 9]}) def speed(self): return self.update({State.A: [State.E, 1], State.B: [State.C, 2], State.D: [State.A, 6], State.C: [State.D, 3], State.F: [State.G, 8]}) def chain(self): return self.update({State.D: [State.B, 5], State.E: [State.F, 7]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class state(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class statemachine: state = state.A def clean(self): return self.update({state.A: [state.B, 0], state.B: [state.C, 2], state.C: [state.A, 4], state.D: [state.A, 6], state.G: [state.H, 10], state.H: [state.A, 11]}) def tail(self): return self.update({state.C: [state.D, 3], state.D: [state.H, 7], state.E: [state.F, 8]}) def close(self): return self.update({state.A: [state.E, 1], state.D: [state.E, 5], state.F: [state.G, 9]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return statemachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class StateMachine: state = State.A def coast(self): return self.update({State.A: [State.B, 0], State.F: [State.A, 8], State.B: [State.D, 3], State.D: [State.E, 5]}) def jump(self): return self.update({State.A: [State.D, 1], State.B: [State.C, 2], State.C: [State.D, 4], State.E: [State.F, 6], State.F: [State.D, 7]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def pan(self): return self.update({State.A: [State.B, 0], State.F: [State.G, 8], State.E: [State.B, 7], State.D: [State.B, 5]}) def pluck(self): return self.update({State.A: [State.C, 1], State.B: [State.C, 2], State.C: [State.D, 3], State.E: [State.F, 6]}) def leer(self): return self.update({State.D: [State.E, 4], State.F: [State.F, 9]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main: def __init__(self): self._cur_state = 'A' def rush(self): if self._cur_state == 'A': self._cur_state = 'B' return 0 if self._cur_state == 'B': self._cur_state = 'E' return 3 if self._cur_state == 'D': self._cur_state = 'E' return 5 if self._cur_state == 'E': self._cur_state = 'F' return 7 raise KeyError() def crawl(self): if self._cur_state == 'A': self._cur_state = 'A' return 1 if self._cur_state == 'B': self._cur_state = 'C' return 2 if self._cur_state == 'C': self._cur_state = 'D' return 4 if self._cur_state == 'D': self._cur_state = 'D' return 6 if self._cur_state == 'E': self._cur_state = 'A' return 8 raise KeyError()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def chain(self): return self.update({State.A: [State.B, 0], State.B: [State.B, 5], State.E: [State.F, 9], State.G: [State.H, 11]}) def log(self): return self.update({State.B: [State.D, 4], State.A: [State.E, 1], State.C: [State.D, 6]}) def show(self): return self.update({State.B: [State.C, 2], State.D: [State.E, 7]}) def cast(self): return self.update({State.B: [State.F, 3], State.D: [State.D, 8], State.F: [State.G, 10]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class Miles_FSM: def __init__(self): self.state = 'A' def step(self): if self.state == 'H': return 11 else: raise KeyError def melt(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'E': self.state = 'F' return 6 elif self.state == 'F': self.state = 'G' return 8 elif self.state == 'G': self.state = 'H' return 10 else: raise KeyError def cue(self): if self.state == 'A': self.state = 'C' return 1 elif self.state == 'B': self.state = 'C' return 2 elif self.state == 'D': self.state = 'E' return 4 elif self.state == 'E': self.state = 'A' return 7 else: raise KeyError def click(self): if self.state == 'C': self.state = 'D' return 3 elif self.state == 'D': self.state = 'A' return 5 elif self.state == 'F': self.state = 'D' return 9 else: raise KeyError def main(): obj = Miles_FSM() return obj" "class main: def __init__(self): self.condition = 'A' def smash(self): if self.condition == 'A': self.condition = 'B' return 0 elif self.condition == 'B': self.condition = 'E' return 2 elif self.condition == 'C': self.condition = 'D' return 3 elif self.condition == 'E': self.condition = 'E' return 7 elif self.condition == 'F': self.condition = 'G' return 8 raise KeyError def check(self): if self.condition == 'B': self.condition = 'C' return 1 elif self.condition == 'C': self.condition = 'E' return 4 elif self.condition == 'D': self.condition = 'E' return 5 raise KeyError def coast(self): if self.condition == 'E': self.condition = 'F' return 6 elif self.condition == 'F': self.condition = 'A' return 9 raise KeyError" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def boost(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 2], State.E: [State.F, 7]}) def hop(self): return self.update({State.A: [State.E, 1], State.B: [State.B, 3], State.C: [State.D, 5], State.F: [State.G, 8]}) def jog(self): return self.update({State.B: [State.G, 4], State.D: [State.E, 6], State.G: [State.C, 9]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class Mili: states = {'A': ((0, 'B'), None, None), 'B': (None, (1, 'C'), None), 'C': ((2, 'D'), (3, 'F'), None), 'D': (None, (5, 'F'), (4, 'E')), 'E': (None, None, (6, 'F')), 'F': ((8, 'B'), None, (7, 'G')), 'G': (None, (9, 'A'), None)} def __init__(self): self.state = 'A' def action(self, n): variants = self.states[self.state] if variants[n] is None: raise KeyError else: self.state = variants[n][1] return variants[n][0] def chat(self): return self.action(0) def fork(self): return self.action(1) def sweep(self): return self.action(2) def main(): return Mili()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class StateMachine: state = State.A def tail(self): return self.update({State.A: [State.B, 0], State.E: [State.F, 5], State.F: [State.A, 8]}) def tread(self): return self.update({State.A: [State.C, 1], State.B: [State.C, 2], State.C: [State.D, 3], State.D: [State.E, 4], State.E: [State.E, 6], State.F: [State.C, 7]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def paste(self): return self.update({State.A: [State.A, 1], State.B: [State.C, 3], State.C: [State.D, 6], State.F: [State.G, 10]}) def crash(self): return self.update({State.A: [State.B, 0], State.B: [State.D, 4], State.C: [State.H, 7]}) def lower(self): return self.update({State.A: [State.F, 2], State.B: [State.G, 5], State.D: [State.E, 8], State.E: [State.F, 9], State.G: [State.H, 11]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class Mili: state = 'A' def coast(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'C': self.state = 'D' return 3 elif self.state == 'F': self.state = 'G' return 8 elif self.state == 'E': self.state = 'E' return 7 else: raise KeyError def sweep(self): if self.state == 'B': self.state = 'C' return 2 elif self.state == 'A': self.state = 'F' return 1 elif self.state == 'D': self.state = 'E' return 4 elif self.state == 'E': self.state = 'F' return 6 else: raise KeyError def erase(self): if self.state == 'F': self.state = 'D' return 9 elif self.state == 'D': self.state = 'G' return 5 else: raise KeyError def main(): return Mili()" "class Nooby: __slots__ = ('state',) def __init__(self): self.state = 'A' def hike(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 1 elif self.state == 'C': self.state = 'D' return 2 elif self.state == 'D': self.state = 'E' return 3 elif self.state == 'E': self.state = 'F' return 4 elif self.state == 'F': self.state = 'A' return 7 else: raise KeyError def open(self): if self.state == 'E': return 5 if self.state == 'F': self.state = 'B' return 6 else: raise KeyError def leer(self): if self.state == 'F': self.state = 'D' return 8 else: raise KeyError def main() -> Nooby: return Nooby()" "class main: def __init__(self): self.state: main.State = main.A(self) def bend(self) -> int: return self.state.bend() def post(self) -> int: return self.state.post() def flip(self) -> int: return self.state.flip() class State: def __init__(self, parent): self.parent: main = parent def bend(self): raise KeyError def post(self): raise KeyError def flip(self): raise KeyError class A(State): def bend(self): self.parent.state = main.B(self.parent) return 0 def flip(self): self.parent.state = main.D(self.parent) return 1 class B(State): def post(self): self.parent.state = main.C(self.parent) return 2 class C(State): def bend(self): self.parent.state = main.D(self.parent) return 3 def flip(self): self.parent.state = main.F(self.parent) return 4 class D(State): def flip(self): self.parent.state = main.E(self.parent) return 5 class E(State): def flip(self): self.parent.state = main.F(self.parent) return 6 class F(State): def bend(self): self.parent.state = main.G(self.parent) return 7 def post(self): self.parent.state = main.H(self.parent) return 8 def flip(self): self.parent.state = main.B(self.parent) return 9 class G(State): def bend(self): self.parent.state = main.H(self.parent) return 10 class H(State): def bend(self): self.parent.state = main.H(self.parent) return 11" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class StateMachine: state = State.A def fork(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 2], State.C: [State.D, 3], State.E: [State.F, 7]}) def pose(self): return self.update({State.A: [State.C, 1], State.C: [State.F, 4], State.F: [State.D, 8]}) def skip(self): return self.update({State.C: [State.E, 5], State.D: [State.E, 6]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main: def __init__(self): self.__state = 'A' def glare(self): if self.__state == 'A': self.__state = 'B' return 0 if self.__state == 'B': self.__state = 'F' return 3 if self.__state == 'C': self.__state = 'E' return 5 if self.__state == 'D': self.__state = 'E' return 6 if self.__state == 'F': self.__state = 'G' return 8 raise KeyError def erase(self): if self.__state == 'A': self.__state = 'D' return 1 if self.__state == 'B': self.__state = 'C' return 2 if self.__state == 'C': self.__state = 'D' return 4 if self.__state == 'E': self.__state = 'F' return 7 if self.__state == 'F': self.__state = 'A' return 9 raise KeyError" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def stand(self): return self.update({State.A: [State.A, 1], State.B: [State.C, 2], State.C: [State.D, 4], State.D: [State.E, 5], State.E: [State.F, 6]}) def trash(self): return self.update({State.A: [State.B, 0], State.B: [State.F, 3], State.E: [State.E, 7], State.G: [State.A, 9], State.F: [State.G, 8]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class Mili: state = -1 def sit(self): if self.state == -1: self.state = 0 elif self.state == 0: self.state = 3 elif self.state in [1, 3]: self.state = 5 elif self.state == 8: self.state = 9 else: raise KeyError return self.state def tag(self): if self.state == -1: self.state = 1 elif self.state in [1, 3]: self.state = 4 elif self.state == 4: self.state = 6 elif self.state in [2, 5, 6, 9]: self.state = 7 elif self.state == 7: self.state = 8 else: raise KeyError return self.state def shade(self): if self.state == -1: self.state = 2 else: raise KeyError return self.state def main(): return Mili()" "class main: def __init__(self): self._state = 'A' self._graph = {('A', 'play'): ('A', 1), ('A', 'close'): ('B', 0), ('B', 'play'): ('C', 2), ('B', 'close'): ('B', 3), ('C', 'close'): ('D', 4), ('D', 'close'): ('D', 6), ('D', 'play'): ('E', 5), ('E', 'play'): ('F', 7), ('F', 'close'): ('G', 8), ('G', 'play'): ('H', 9), ('G', 'close'): ('D', 10), ('H', 'close'): ('F', 11)} def play(self): (self._state, output) = self._graph[self._state, 'play'] return output def close(self): (self._state, output) = self._graph[self._state, 'close'] return output" "class main: def __init__(self): self.name = 'A' def rush(self): if self.name == 'A': self.name = 'B' return 0 elif self.name == 'C': self.name = 'G' return 3 elif self.name == 'D': self.name = 'G' return 5 elif self.name == 'E': self.name = 'F' return 6 elif self.name == 'G': self.name = 'E' return 9 else: raise KeyError def amass(self): if self.name == 'B': self.name = 'C' return 1 elif self.name == 'C': self.name = 'D' return 2 elif self.name == 'D': self.name = 'E' return 4 elif self.name == 'E': self.name = 'C' return 7 elif self.name == 'F': self.name = 'G' return 8 else: raise KeyError" "class Mealy: state = 'A' def check(self): if self.state == 'A': self.state = 'B' return 0 if self.state == 'B': self.state = 'C' return 1 if self.state == 'C': self.state = 'C' return 3 if self.state == 'F': self.state = 'F' return 8 if self.state == 'E': self.state = 'A' return 6 raise KeyError def show(self): if self.state == 'C': self.state = 'D' return 2 if self.state == 'D': self.state = 'E' return 4 if self.state == 'E': self.state = 'F' return 5 if self.state == 'F': self.state = 'D' return 9 raise KeyError def rev(self): if self.state == 'F': self.state = 'G' return 7 raise KeyError def main(): o = Mealy() return o" "class main: def __init__(self): self.currentPoint = 'A' def click(self): match self.currentPoint: case 'A': self.currentPoint = 'A' return 1 case 'B': self.currentPoint = 'F' return 3 case 'C': self.currentPoint = 'F' return 5 case 'E': self.currentPoint = 'F' return 7 case 'D': raise KeyError case _: raise KeyError def clone(self): match self.currentPoint: case 'A': self.currentPoint = 'B' return 0 case 'B': self.currentPoint = 'C' return 2 case 'C': self.currentPoint = 'D' return 4 case 'D': self.currentPoint = 'E' return 6 case 'E': self.currentPoint = 'E' return 8 case _: raise KeyError" "class main: def __init__(self) -> None: self.level = 0 def code(self): if self.level == 0: self.level = 1 return 0 elif self.level == 3: self.level = 5 return 7 elif self.level == 5: self.level = 6 return 9 else: raise KeyError() def clean(self): if self.level == 0: self.level = 4 return 1 elif self.level == 2: self.level = 5 return 4 elif self.level == 3: self.level = 4 return 5 elif self.level == 5: self.level = 1 return 10 elif self.level == 4: self.level = 5 return 8 else: raise KeyError() def fade(self): if self.level == 1: self.level = 2 return 2 elif self.level == 2: self.level = 3 return 3 elif self.level == 3: self.level = 1 return 6 elif self.level == 6: self.level = 7 return 11 else: raise KeyError()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class StateMachine: state = State.A def fetch(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 3], State.C: [State.D, 5], State.E: [State.F, 7], State.F: [State.C, 9]}) def shade(self): return self.update({State.A: [State.C, 2], State.F: [State.G, 8]}) def base(self): return self.update({State.B: [State.E, 4], State.D: [State.E, 6], State.A: [State.G, 1]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def throw(self): return self.update({State.A: [State.B, 0], State.C: [State.D, 3], State.E: [State.F, 6], State.F: [State.B, 9]}) def mask(self): return self.update({State.A: [State.G, 1], State.B: [State.C, 2], State.D: [State.E, 4], State.F: [State.F, 8], State.H: [State.D, 11]}) def add(self): return self.update({State.D: [State.G, 5], State.F: [State.G, 7], State.G: [State.H, 10]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class StateMachine: state = State.A def edit(self): return self.update({State.A: [State.B, 0], State.B: [State.D, 3], State.C: [State.D, 6]}) def skip(self): return self.update({State.A: [State.E, 1], State.B: [State.B, 5], State.D: [State.E, 7]}) def melt(self): return self.update({State.B: [State.C, 2], State.E: [State.F, 8]}) def tag(self): return self.update({State.B: [State.F, 4], State.F: [State.G, 9]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def group(self): return self.update({State.A: [State.B, 0], State.C: [State.A, 5], State.F: [State.F, 9], State.H: [State.F, 11]}) def add(self): return self.update({State.B: [State.C, 3], State.C: [State.D, 4], State.A: [State.E, 1], State.E: [State.F, 7], State.F: [State.G, 8]}) def type(self): return self.update({State.A: [State.G, 2], State.D: [State.E, 6], State.G: [State.H, 10]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main: def __init__(self): self.cernels = ['A', 'B', 'C', 'D', 'E', 'F', 'G'] self.cernel = self.cernels[0] self.status = None def mass(self): if self.cernel == self.cernels[0]: self.status = 0 self.cernel = self.cernels[1] elif self.cernel == self.cernels[1]: self.status = 2 self.cernel = self.cernels[2] elif self.cernel == self.cernels[3]: self.status = 4 self.cernel = self.cernels[4] elif self.cernel == self.cernels[4]: self.status = 6 self.cernel = self.cernels[5] else: raise KeyError return self.status def slip(self): if self.cernel == self.cernels[2]: self.status = 3 self.cernel = self.cernels[3] elif self.cernel == self.cernels[0]: self.status = 1 self.cernel = self.cernels[6] elif self.cernel == self.cernels[4]: self.status = 7 self.cernel = self.cernels[6] elif self.cernel == self.cernels[3]: self.status = 5 self.cernel = self.cernels[6] else: raise KeyError return self.status def chain(self): if self.cernel == self.cernels[4]: self.status = 8 self.cernel = self.cernels[2] elif self.cernel == self.cernels[5]: self.status = 9 self.cernel = self.cernels[6] else: raise KeyError return self.status" "class FSM: def __init__(self): self.A = 'A' self.B = 'B' self.C = 'C' self.D = 'D' self.E = 'E' self.F = 'F' self.G = 'G' self.start = self.A self.current_state = self.start def post(self): if self.current_state == self.A: self.current_state = self.B return 0 elif self.current_state == self.B: self.current_state = self.C return 1 else: raise KeyError def blame(self): if self.current_state == self.B: self.current_state = self.E return 2 elif self.current_state == self.D: self.current_state = self.E return 6 elif self.current_state == self.C: self.current_state = self.A return 5 elif self.current_state == self.E: self.current_state = self.F return 7 elif self.current_state == self.F: self.current_state = self.G return 8 else: raise KeyError def sway(self): if self.current_state == self.C: self.current_state = self.D return 4 elif self.current_state == self.B: self.current_state = self.D return 3 elif self.current_state == self.G: self.current_state = self.C return 9 else: raise KeyError def main(): state_machine = FSM() return state_machine" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def paste(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 1], State.F: [State.A, 7]}) def pluck(self): return self.update({State.B: [State.B, 2], State.F: [State.B, 8], State.D: [State.E, 4]}) def show(self): return self.update({State.C: [State.D, 3], State.E: [State.F, 5], State.F: [State.C, 6]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main: state = 0 Push = {4: [6, 5], 1: [2, 6], 5: [10, 2], 6: [11, 7]} Put = {1: [3, 3], 2: [4, 3], 4: [7, 4]} Send = {0: [0, 1], 1: [1, 2], 3: [5, 4], 4: [8, 7], 5: [9, 6]} def send(self): temp = self.state if self.Send.get(temp, 'KeyError')[1] != 'e': self.state = self.Send.get(temp, 'KeyError')[1] return int(self.Send.get(temp)[0]) else: raise KeyError def push(self): temp = self.state if self.Push.get(temp, 'KeyError')[1] != 'e': self.state = self.Push.get(temp, 'KeyError')[1] return int(self.Push.get(temp)[0]) else: raise KeyError def put(self): temp = self.state if self.Put.get(temp, 'KeyError')[1] != 'e': self.state = self.Put.get(temp, 'KeyError')[1] return int(self.Put.get(temp)[0]) else: raise KeyError" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class StateMachine: state = State.A def cast(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 1], State.C: [State.E, 4], State.D: [State.E, 5], State.F: [State.D, 8]}) def patch(self): return self.update({State.C: [State.D, 3], State.E: [State.F, 6], State.F: [State.G, 7], State.G: [State.A, 9]}) def open(self): return self.update({State.B: [State.F, 2]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class StateMachine: state = State.A def amass(self): return self.update({State.A: [State.B, 0], State.B: [State.G, 5], State.C: [State.D, 6], State.D: [State.E, 7], State.E: [State.F, 8]}) def tweak(self): return self.update({State.B: [State.B, 4], State.A: [State.G, 1], State.F: [State.G, 9]}) def jump(self): return self.update({State.A: [State.D, 2], State.B: [State.C, 3]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main: def __init__(self): self.cur_state = 'A' def zoom(self): if self.cur_state == 'A': self.cur_state = 'B' return 0 elif self.cur_state == 'B': self.cur_state = 'C' return 1 elif self.cur_state == 'D': self.cur_state = 'A' return 5 elif self.cur_state == 'E': self.cur_state = 'F' return 6 elif self.cur_state == 'F': self.cur_state = 'F' return 8 else: raise KeyError def peep(self): if self.cur_state == 'B': self.cur_state = 'D' return 2 elif self.cur_state == 'D': self.cur_state = 'E' return 4 elif self.cur_state == 'E': self.cur_state = 'B' return 7 elif self.cur_state == 'C': self.cur_state = 'D' return 3 else: raise KeyError" "class main: def __init__(self): self.condition = 'A' def leer(self): if self.condition == 'A': self.condition = 'B' return 0 else: raise KeyError def flip(self): if self.condition == 'A': self.condition = 'C' return 2 elif self.condition == 'B': self.condition = 'C' return 3 else: raise KeyError def mass(self): if self.condition == 'A': self.condition = 'D' return 1 elif self.condition == 'C': self.condition = 'D' return 5 elif self.condition == 'D': self.condition = 'E' return 6 elif self.condition == 'B': self.condition = 'E' return 4 elif self.condition == 'F': self.condition = 'B' return 8 elif self.condition == 'E': self.condition = 'F' return 7 else: raise KeyError" "class FSM: def __init__(self): self.A = 'A' self.B = 'B' self.C = 'C' self.D = 'D' self.E = 'E' self.F = 'F' self.G = 'G' self.H = 'H' self.start = self.A self.current_state = self.start def put(self): if self.current_state == self.A: self.current_state = self.B return 0 elif self.current_state == self.B: self.current_state = self.E return 3 elif self.current_state == self.D: self.current_state = self.E return 5 elif self.current_state == self.E: self.current_state = self.F return 7 elif self.current_state == self.F: self.current_state = self.B return 10 elif self.current_state == self.G: self.current_state = self.H return 11 else: raise KeyError def stall(self): if self.current_state == self.A: return 1 elif self.current_state == self.B: self.current_state = self.C return 2 elif self.current_state == self.C: self.current_state = self.D return 4 elif self.current_state == self.D: return 6 elif self.current_state == self.E: self.current_state = self.C return 8 elif self.current_state == self.F: self.current_state = self.G return 9 else: raise KeyError def main(): evaluator = FSM() return evaluator" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def begin(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 1], State.C: [State.G, 3], State.G: [State.D, 9], State.D: [State.F, 5], State.E: [State.C, 7]}) def spin(self): return self.update({State.C: [State.D, 2], State.D: [State.E, 4], State.E: [State.F, 6], State.F: [State.G, 8]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class Machine: state = 'A' def init(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'G': self.state = 'E' return 9 else: raise KeyError def dash(self): if self.state == 'A': return 1 elif self.state == 'B': self.state = 'C' return 3 elif self.state == 'E': self.state = 'F' return 6 elif self.state == 'F': self.state = 'G' return 7 elif self.state == 'G': return 8 else: raise KeyError def cut(self): if self.state == 'A': self.state = 'C' return 2 elif self.state == 'C': self.state = 'D' return 4 elif self.state == 'D': self.state = 'E' return 5 else: raise KeyError def main(): return Machine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class StateMachine: state = State.A def hop(self): return self.update({State.A: [State.A, 2], State.C: [State.D, 4], State.E: [State.F, 7], State.F: [State.C, 9]}) def crawl(self): return self.update({State.A: [State.G, 1], State.F: [State.G, 8], State.D: [State.E, 6]}) def click(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 3], State.C: [State.A, 5]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class StateMachine: state = State.A def stash(self): return self.update({State.A: [State.B, 0], State.C: [State.D, 4], State.E: [State.E, 7]}) def clear(self): return self.update({State.A: [State.E, 1], State.B: [State.D, 3], State.D: [State.E, 5], State.E: [State.F, 6], State.F: [State.A, 8]}) def rev(self): return self.update({State.B: [State.C, 2]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main: def __init__(self): self.condition = 'A' def clone(self): if self.condition == 'A': self.condition = 'B' return 0 elif self.condition == 'B': self.condition = 'C' return 1 elif self.condition == 'F': self.condition = 'G' return 7 elif self.condition == 'C': self.condition = 'A' return 3 else: raise KeyError def place(self): if self.condition == 'C': self.condition = 'D' return 2 elif self.condition == 'F': self.condition = 'B' return 8 elif self.condition == 'E': self.condition = 'F' return 6 elif self.condition == 'D': self.condition = 'F' return 5 else: raise KeyError def post(self): if self.condition == 'F': self.condition = 'C' return 9 elif self.condition == 'D': self.condition = 'E' return 4 else: raise KeyError" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class StateMachine: state = State.A def slip(self): return self.update({State.A: [State.B, 0], State.C: [State.A, 6], State.B: [State.D, 3], State.D: [State.E, 7], State.E: [State.F, 8]}) def chat(self): return self.update({State.A: [State.F, 1], State.B: [State.B, 4], State.C: [State.D, 5]}) def pose(self): return self.update({State.B: [State.C, 2], State.F: [State.F, 9]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class StateMachine: state = State.A def split(self): return self.update({State.A: [State.B, 0], State.B: [State.E, 3], State.C: [State.F, 5], State.D: [State.E, 6], State.E: [State.F, 7]}) def crush(self): return self.update({State.A: [State.F, 1], State.B: [State.C, 2], State.C: [State.D, 4], State.F: [State.B, 8]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main: def __init__(self): self.condition = 'A' def etch(self): if self.condition == 'A': self.condition = 'B' return 0 elif self.condition == 'C': self.condition = 'E' return 5 elif self.condition == 'G': self.condition = 'G' return 9 else: raise KeyError def boost(self): if self.condition == 'C': self.condition = 'A' return 4 elif self.condition == 'F': self.condition = 'G' return 8 else: raise KeyError def coat(self): if self.condition == 'B': self.condition = 'C' return 1 elif self.condition == 'D': self.condition = 'E' return 6 elif self.condition == 'E': self.condition = 'F' return 7 elif self.condition == 'C': self.condition = 'D' return 2 else: raise KeyError def smash(self): if self.condition == 'C': self.condition = 'G' return 3 else: raise KeyError" "class Mili: state = 'A' def crack(self): if self.state == 'A': self.state = 'C' return 1 elif self.state == 'C': self.state = 'D' return 4 elif self.state == 'D': self.state = 'E' return 5 elif self.state == 'E': self.state = 'B' return 8 elif self.state == 'B': self.state = 'F' return 3 else: raise KeyError def smash(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 2 elif self.state == 'E': self.state = 'A' return 7 else: raise KeyError def get(self): if self.state == 'E': self.state = 'F' return 6 else: raise KeyError def main(): return Mili()" "class Machine: s = 'A' def peek(self): if self.s == 'A': self.s = 'B' return 0 elif self.s == 'E': return 6 elif self.s == 'F': self.s = 'B' return 9 else: raise KeyError def post(self): if self.s == 'B': self.s = 'C' return 1 elif self.s == 'C': self.s = 'D' return 3 elif self.s == 'D': self.s = 'E' return 4 elif self.s == 'E': self.s = 'A' return 7 else: raise KeyError def group(self): if self.s == 'B': self.s = 'E' return 2 elif self.s == 'F': self.s = 'G' return 8 elif self.s == 'G': self.s = 'H' return 10 elif self.s == 'H': self.s = 'F' return 11 elif self.s == 'E': self.s = 'F' return 5 else: raise KeyError def main(): return Machine()" "import re class main: now_letter = 'A' slov_amble = {'A': '0B', 'B': '1C', 'D': '6A'} slov_hop = {'B': '3D', 'E': '8A'} slov_slip = {'B': '2F', 'C': '4D', 'D': '5E', 'E': '7F'} def amble(self): temp_amble = self.now_letter num = '' letter = '' if self.slov_amble.get(temp_amble, 'KeyError')[1] != 'e': let = re.findall('\\D', self.slov_amble.get(temp_amble, 'KeyError')) for e in let: letter += str(e) self.now_letter = letter number = re.findall('\\d', self.slov_amble.get(temp_amble)) for e in number: num += str(e) return int(num) else: raise KeyError def hop(self): temp_hop = self.now_letter num = '' letter = '' if self.slov_hop.get(temp_hop, 'KeyError')[1] != 'e': let = re.findall('\\D', self.slov_hop.get(temp_hop, 'KeyError')) for e in let: letter += str(e) self.now_letter = letter number = re.findall('\\d', self.slov_hop.get(temp_hop)) for e in number: num += str(e) return int(num) else: raise KeyError def slip(self): temp_slip = self.now_letter num = '' letter = '' if self.slov_slip.get(temp_slip, 'KeyError')[1] != 'e': let = re.findall('\\D', self.slov_slip.get(temp_slip, 'KeyError')) for e in let: letter += str(e) self.now_letter = letter number = re.findall('\\d', self.slov_slip.get(temp_slip)) for e in number: num += str(e) return int(num) else: raise KeyError" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class StateMachine: state = State.A def exit(self): return self.update({State.A: [State.A, 1], State.C: [State.D, 3], State.D: [State.E, 4], State.E: [State.A, 6], State.F: [State.D, 8]}) def chat(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 2], State.E: [State.F, 5], State.F: [State.G, 7], State.G: [State.A, 9]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 1 B = 2 C = 3 D = 4 E = 5 F = 6 G = 7 class main: def __init__(self): self.__state = State.A def march(self) -> int: match self.__state: case State.A: self.__state = State.B return 0 case State.B: self.__state = State.C return 1 case State.C: self.__state = State.D return 3 case State.E: self.__state = State.G return 6 case State.G: self.__state = State.D return 9 raise KeyError def close(self) -> int: match self.__state: case State.B: return 2 case State.D: self.__state = State.E return 4 case State.E: self.__state = State.F return 5 case State.F: self.__state = State.G return 7 case State.G: self.__state = State.A return 8 raise KeyError" "class main: def __init__(self): self.name = 'A' def wreck(self): if self.name == 'A': self.name = 'B' return 0 elif self.name == 'C': self.name = 'D' return 3 elif self.name == 'D': self.name = 'G' return 6 elif self.name == 'E': self.name = 'H' return 8 elif self.name == 'F': self.name = 'G' return 9 elif self.name == 'H': self.name = 'F' return 11 else: raise KeyError def zoom(self): if self.name == 'A': self.name = 'D' return 1 elif self.name == 'B': self.name = 'C' return 2 elif self.name == 'C': self.name = 'A' return 4 elif self.name == 'D': self.name = 'E' return 5 elif self.name == 'E': self.name = 'F' return 7 elif self.name == 'G': self.name = 'H' return 10 else: raise KeyError" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class StateMachine: state = State.A def log(self): return self.update({State.A: [State.B, 0], State.B: [State.D, 2], State.D: [State.E, 4], State.F: [State.G, 7]}) def fade(self): return self.update({State.B: [State.C, 1], State.C: [State.D, 3], State.D: [State.G, 5], State.E: [State.F, 6], State.F: [State.F, 8], State.G: [State.B, 9]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class StateMachine: state = 'A' def cast(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 1 elif self.state == 'E': self.state = 'C' return 6 elif self.state == 'F': self.state = 'C' return 7 else: raise KeyError def chain(self): if self.state == 'B': self.state = 'E' return 2 elif self.state == 'D': self.state = 'E' return 4 elif self.state == 'F': self.state = 'D' return 8 elif self.state == 'E': self.state = 'F' return 5 elif self.state == 'C': self.state = 'D' return 3 else: raise KeyError def drive(self): if self.state == 'E': self.state = 'A' return 8 else: raise KeyError def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class StateMachine: state = State.A def rush(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 1], State.D: [State.E, 5], State.E: [State.F, 6]}) def cut(self): return self.update({State.B: [State.B, 2], State.C: [State.D, 4], State.E: [State.B, 7]}) def etch(self): return self.update({State.B: [State.F, 3], State.F: [State.C, 8]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class StateMachine: state = State.A def race(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 3], State.D: [State.E, 5], State.F: [State.B, 8]}) def push(self): return self.update({State.A: [State.C, 1], State.C: [State.D, 4], State.D: [State.D, 6], State.E: [State.F, 7]}) def widen(self): return self.update({State.A: [State.E, 2]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main: def __init__(self): self.point = 'A' def leer(self): if self.point == 'A': self.point = 'B' return 0 elif self.point == 'B': self.point = 'D' return 2 elif self.point == 'C': self.point = 'D' return 3 elif self.point == 'E': self.point = 'F' return 5 elif self.point == 'G': self.point = 'H' return 8 elif self.point == 'H': self.point = 'H' return 10 else: raise KeyError def roam(self): if self.point == 'B': self.point = 'C' return 1 elif self.point == 'F': self.point = 'G' return 7 elif self.point == 'H': self.point = 'A' return 11 elif self.point == 'G': self.point = 'E' return 9 else: raise KeyError def pan(self): if self.point == 'D': self.point = 'E' return 4 elif self.point == 'E': self.point = 'C' return 6 else: raise KeyError" "class AntiHype: def __init__(self): self.A = 'A' self.B = 'B' self.C = 'C' self.D = 'D' self.E = 'E' self.F = 'F' self.start = self.A self.current_state = self.start def spin(self): if self.current_state == self.A: self.current_state = self.B return 0 elif self.current_state == self.B: self.current_state = self.C return 1 elif self.current_state == self.E: self.current_state = self.A return 7 elif self.current_state == self.D: self.current_state = self.E return 3 else: raise KeyError def run(self): if self.current_state == self.C: self.current_state = self.D return 2 elif self.current_state == self.D: return 5 else: raise KeyError def push(self): if self.current_state == self.D: self.current_state = self.F return 4 elif self.current_state == self.F: return 8 elif self.current_state == self.E: self.current_state = self.F return 6 else: raise KeyError def main(): mom = AntiHype() return mom" "class main: def __init__(self): self.__state = 'A' def bolt(self): if self.__state == 'A': self.__state = 'B' return 0 if self.__state == 'B': self.__state = 'H' return 4 if self.__state == 'E': self.__state = 'F' return 8 raise KeyError def punch(self): if self.__state == 'B': self.__state = 'C' return 1 if self.__state == 'D': self.__state = 'E' return 6 if self.__state == 'F': self.__state = 'G' return 9 if self.__state == 'G': self.__state = 'H' return 11 raise KeyError def scan(self): if self.__state == 'B': self.__state = 'E' return 2 if self.__state == 'F': self.__state = 'D' return 10 if self.__state == 'C': self.__state = 'D' return 5 if self.__state == 'D': self.__state = 'H' return 7 raise KeyError def jog(self): if self.__state == 'B': self.__state = 'F' return 3 raise KeyError" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def trim(self): return self.update({State.A: [State.B, 0], State.D: [State.B, 6], State.F: [State.G, 8], State.B: [State.E, 3]}) def pluck(self): return self.update({State.A: [State.A, 1], State.B: [State.C, 2], State.C: [State.D, 4], State.D: [State.E, 5], State.E: [State.F, 7], State.G: [State.E, 9]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main: def __init__(self): self.__state = 'A' def fetch(self): if self.__state == 'A': self.__state = 'B' return 0 if self.__state == 'B': self.__state = 'C' return 1 if self.__state == 'C': self.__state = 'D' return 5 if self.__state == 'F': self.__state = 'C' return 10 if self.__state == 'G': self.__state = 'H' return 11 raise KeyError def coast(self): if self.__state == 'B': self.__state = 'H' return 2 raise KeyError def daub(self): if self.__state == 'B': self.__state = 'D' return 3 if self.__state == 'F': return 9 raise KeyError def pan(self): if self.__state == 'B': self.__state = 'E' return 4 if self.__state == 'D': self.__state = 'E' return 6 if self.__state == 'E': self.__state = 'F' return 7 if self.__state == 'F': self.__state = 'G' return 8 raise KeyError" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class StateMachine: state = State.A def make(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 3], State.E: [State.C, 8]}) def stash(self): return self.update({State.A: [State.C, 2], State.B: [State.F, 4], State.C: [State.D, 5], State.D: [State.E, 6], State.E: [State.F, 7]}) def close(self): return self.update({State.A: [State.A, 1]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main: def __init__(self): self.__state = 'A' def roam(self): if self.__state == 'A': self.__state = 'B' return 0 if self.__state == 'C': self.__state = 'E' return 4 if self.__state == 'D': self.__state = 'E' return 5 raise KeyError def turn(self): if self.__state == 'A': self.__state = 'C' return 1 if self.__state == 'B': self.__state = 'C' return 2 if self.__state == 'C': self.__state = 'D' return 3 if self.__state == 'D': self.__state = 'F' return 6 if self.__state == 'E': self.__state = 'F' return 7 if self.__state == 'F': self.__state = 'C' return 8 raise KeyError" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class StateMachine: state = State.A def swap(self): return self.update({State.A: [State.B, 0], State.C: [State.F, 3], State.D: [State.B, 5], State.E: [State.F, 6], State.F: [State.A, 8]}) def color(self): return self.update({State.B: [State.C, 1], State.C: [State.D, 2], State.D: [State.E, 4], State.E: [State.B, 7]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main: def __init__(self): self.condition = 'A' def model(self): if self.condition == 'A': self.condition = 'B' return 0 elif self.condition == 'F': self.condition = 'F' return 8 else: raise KeyError def chat(self): if self.condition == 'A': self.condition = 'C' return 2 elif self.condition == 'C': self.condition = 'D' return 4 elif self.condition == 'D': self.condition = 'E' return 5 elif self.condition == 'E': self.condition = 'F' return 7 else: raise KeyError def shade(self): if self.condition == 'A': self.condition = 'D' return 1 elif self.condition == 'D': self.condition = 'D' return 6 elif self.condition == 'B': self.condition = 'C' return 3 else: raise KeyError" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def sit(self): return self.update({State.A: [State.B, 0], State.C: [State.D, 4], State.D: [State.B, 7], State.F: [State.G, 9]}) def sort(self): return self.update({State.B: [State.C, 2], State.D: [State.F, 6], State.E: [State.F, 8]}) def scan(self): return self.update({State.A: [State.D, 1], State.D: [State.E, 5], State.G: [State.B, 3]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class StateMachine: state = State.A def init(self): return self.update({State.A: [State.B, 0], State.E: [State.F, 7]}) def clean(self): return self.update({State.A: [State.C, 1], State.B: [State.C, 2], State.C: [State.D, 4], State.D: [State.A, 6]}) def stay(self): return self.update({State.B: [State.D, 3], State.D: [State.E, 5], State.E: [State.B, 8]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class StateMachine: state = State.A def chain(self): return self.update({State.A: [State.A, 1], State.B: [State.C, 3], State.D: [State.E, 7]}) def glare(self): return self.update({State.A: [State.B, 0], State.B: [State.B, 4], State.E: [State.F, 8]}) def zoom(self): return self.update({State.A: [State.C, 2], State.C: [State.D, 6], State.B: [State.E, 5]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class Mealy: state = 'A' def click(self): if self.state == 'A': self.state = 'B' return 0 if self.state == 'B': self.state = 'G' return 3 if self.state == 'C': self.state = 'D' return 4 if self.state == 'D': self.state = 'E' return 5 if self.state == 'E': self.state = 'F' return 8 if self.state == 'G': self.state = 'D' return 11 raise KeyError def smash(self): if self.state == 'A': self.state = 'E' return 1 if self.state == 'D': self.state = 'D' return 6 if self.state == 'F': self.state = 'G' return 9 if self.state == 'G': self.state = 'H' return 10 raise KeyError def get(self): if self.state == 'B': self.state = 'C' return 2 if self.state == 'D': self.state = 'F' return 7 raise KeyError def main(): o = Mealy() return o" "import enum class MilliState(enum.Enum): STATE_A = 0 STATE_B = 1 STATE_C = 2 STATE_D = 3 STATE_E = 4 STATE_F = 5 STATE_G = 6 STATE_H = 7 class Milli: def __init__(self, state): self._state = state def visit(self): if self._state == MilliState.STATE_A: self._state = MilliState.STATE_B return 0 elif self._state == MilliState.STATE_B: self._state = MilliState.STATE_E return 4 elif self._state == MilliState.STATE_C: self._state = MilliState.STATE_D return 5 elif self._state == MilliState.STATE_D: self._state = MilliState.STATE_E return 6 else: raise KeyError def spin(self): if self._state == MilliState.STATE_A: self._state = MilliState.STATE_C return 1 elif self._state == MilliState.STATE_B: self._state = MilliState.STATE_C return 2 elif self._state == MilliState.STATE_F: self._state = MilliState.STATE_G return 8 else: raise KeyError def pose(self): if self._state == MilliState.STATE_B: self._state = MilliState.STATE_B return 3 elif self._state == MilliState.STATE_E: self._state = MilliState.STATE_F return 7 elif self._state == MilliState.STATE_F: self._state = MilliState.STATE_A return 9 else: raise KeyError def main(): return Milli(MilliState.STATE_A)" "from enum import Enum, auto class State(Enum): A = auto() B = auto() C = auto() D = auto() E = auto() F = auto() G = auto() H = auto() def main(): return Main() class Main: def __init__(self) -> None: self.state = State.A def skid(self): match self.state: case State.A: self.state = State.B return 0 case State.B: self.state = State.G return 2 case State.C: self.state = State.F return 4 case State.D: self.state = State.A return 7 case State.E: raise KeyError() case State.F: self.state = State.G return 9 case State.G: raise KeyError() case State.H: raise KeyError() def slip(self): match self.state: case State.A: raise KeyError() case State.B: raise KeyError() case State.C: self.state = State.E return 5 case State.D: raise KeyError() case State.E: self.state = State.F return 8 case State.F: raise KeyError() case State.G: self.state = State.A return 11 case State.H: raise KeyError() def forge(self): match self.state: case State.A: raise KeyError() case State.B: self.state = State.C return 1 case State.C: self.state = State.D return 3 case State.D: self.state = State.E return 6 case State.E: raise KeyError() case State.F: raise KeyError() case State.G: self.state = State.H return 10 case State.H: raise KeyError() o = main() o.skid() o.forge() o.slip() o.slip() o.skid() o.slip() o.skid() o.skid() o.slip() o.skid() o.forge() o.forge() o.forge() o.slip() o.skid() o.forge()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class StateMachine: state = State.A def fork(self): return self.update({State.A: [State.B, 0], State.E: [State.F, 7]}) def coat(self): return self.update({State.B: [State.C, 2], State.D: [State.B, 6], State.C: [State.D, 4], State.A: [State.D, 1], State.F: [State.G, 8]}) def build(self): return self.update({State.B: [State.F, 3], State.D: [State.E, 5], State.F: [State.F, 9]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def blame(self): return self.update({State.A: [State.B, 0], State.B: [State.E, 2], State.C: [State.D, 3], State.D: [State.D, 6], State.E: [State.F, 7], State.F: [State.B, 9]}) def coat(self): return self.update({State.B: [State.C, 1], State.C: [State.H, 4], State.D: [State.E, 5], State.F: [State.G, 8], State.G: [State.H, 10], State.H: [State.E, 11]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class StateMachine: state = State.A def shift(self): return self.update({State.A: [State.B, 0], State.D: [State.E, 6], State.E: [State.F, 7], State.F: [State.B, 8]}) def file(self): return self.update({State.A: [State.C, 1], State.B: [State.B, 4], State.C: [State.D, 5]}) def fetch(self): return self.update({State.A: [State.E, 2], State.B: [State.C, 3]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class StateMachine: state = State.A def rush(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 3], State.C: [State.D, 5], State.D: [State.E, 7]}) def link(self): return self.update({State.A: [State.A, 2], State.B: [State.E, 4], State.C: [State.G, 6], State.E: [State.F, 8]}) def pluck(self): return self.update({State.A: [State.G, 1], State.F: [State.G, 9]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class Milly: def __init__(self): self.current_state = 'A' self.TREAD = {'A': {'value': 0, 'new_state': 'B'}, 'C': {'value': 2, 'new_state': 'D'}, 'D': {'value': 3, 'new_state': 'E'}, 'E': {'value': 6, 'new_state': 'E'}, 'G': {'value': 10, 'new_state': 'D'}} self.FORGE = {'G': {'value': 11, 'new_state': 'C'}, 'F': {'value': 8, 'new_state': 'C'}} self.MASK = {'B': {'value': 1, 'new_state': 'C'}, 'D': {'value': 4, 'new_state': 'B'}, 'E': {'value': 5, 'new_state': 'F'}, 'F': {'value': 7, 'new_state': 'G'}, 'G': {'value': 9, 'new_state': 'H'}} def tread(self): result = self.TREAD[self.current_state] self.current_state = result['new_state'] return result['value'] def forge(self): result = self.FORGE[self.current_state] self.current_state = result['new_state'] return result['value'] def mask(self): result = self.MASK[self.current_state] self.current_state = result['new_state'] return result['value'] def main(): return Milly()" "class Mealy: state = 'A' def hoard(self): if self.state == 'A': self.state = 'B' return 0 if self.state == 'B': self.state = 'C' return 1 if self.state == 'C': self.state = 'D' return 4 if self.state == 'E': self.state = 'F' return 6 if self.state == 'F': self.state = 'H' return 9 raise KeyError def apply(self): if self.state == 'B': self.state = 'F' return 2 if self.state == 'D': self.state = 'E' return 5 if self.state == 'E': self.state = 'G' return 7 if self.state == 'F': self.state = 'G' return 8 if self.state == 'G': self.state = 'H' return 10 raise KeyError def dash(self): if self.state == 'B': self.state = 'G' return 3 if self.state == 'G': self.state = 'D' return 11 raise KeyError def main(): o = Mealy() return o" "class main: def __init__(self): self._state = 'A' self._graph = {('A', 'align'): ('B', 0), ('B', 'align'): ('C', 1), ('C', 'align'): ('D', 3), ('D', 'align'): ('E', 4), ('E', 'click'): ('F', 6), ('D', 'mass'): ('B', 5), ('F', 'align'): ('F', 9), ('B', 'group'): ('F', 2), ('F', 'mass'): ('A', 8), ('F', 'click'): ('G', 7), ('G', 'click'): ('H', 11), ('F', 'group'): ('H', 10)} def align(self): (self._state, output) = self._graph[self._state, 'align'] return output def mass(self): (self._state, output) = self._graph[self._state, 'mass'] return output def click(self): (self._state, output) = self._graph[self._state, 'click'] return output def group(self): (self._state, output) = self._graph[self._state, 'group'] return output" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class StateMachine: state = State.A def clear(self): return self.update({State.A: [State.B, 0], State.D: [State.B, 5]}) def bolt(self): return self.update({State.B: [State.C, 1], State.C: [State.D, 2], State.D: [State.E, 4], State.E: [State.B, 8]}) def fetch(self): return self.update({State.C: [State.C, 3], State.D: [State.F, 6], State.E: [State.F, 7]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main: x = 'a' def color(self): return self.transition({'a': ['a', 1], 'b': ['c', 2], 'e': ['f', 6], 'c': ['g', 4], 'f': ['b', 8], 'g': ['h', 9], 'h': ['a', 11]}) def chip(self): return self.transition({'a': ['b', 0], 'c': ['d', 3], 'd': ['e', 5], 'f': ['g', 7], 'g': ['g', 10]}) def transition(self, transitions): signal = transitions[self.x][1] self.x = transitions[self.x][0] return signal" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def scan(self): return self.update({State.A: [State.B, 0], State.B: [State.D, 3]}) def bolt(self): return self.update({State.A: [State.C, 1], State.F: [State.B, 8]}) def exit(self): return self.update({State.B: [State.C, 2], State.C: [State.D, 4], State.D: [State.E, 5], State.E: [State.F, 6], State.F: [State.A, 7]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main: def __init__(self): self.level = 0 def brake(self): if self.level == 0: self.level = 1 return 0 elif self.level == 1: self.level = 5 return 2 elif self.level == 2: self.level = 3 return 3 elif self.level == 3: self.level = 4 return 5 elif self.level == 6: self.level = 1 return 8 else: raise KeyError() def clear(self): if self.level == 1: self.level = 2 return 1 elif self.level == 2: self.level = 6 return 4 elif self.level == 4: self.level = 5 return 6 elif self.level == 5: self.level = 6 return 7 elif self.level == 6: self.level = 3 return 9 else: raise KeyError()" "def main(): class mille: def __init__(self): self.cur_state = 'A' self.routes = {'A': ['key error', ('B', 0)], 'B': [('C', 1), 'key error'], 'C': [('F', 3), ('D', 2)], 'D': [('A', 5), ('E', 4)], 'E': [('B', 7), ('F', 6)], 'F': ['key error', ('B', 8)]} def forge(self): if self.routes[self.cur_state][1] != 'key error': result = self.routes[self.cur_state][1][1] self.cur_state = self.routes[self.cur_state][1][0] return result else: raise KeyError def apply(self): if self.routes[self.cur_state][0] != 'key error': result = self.routes[self.cur_state][0][1] self.cur_state = self.routes[self.cur_state][0][0] return result else: raise KeyError return mille() o = main() o.forge() o.apply() o.forge() o.apply() o.forge()" "class main: def __init__(self): self.condition = 'A' def debug(self): if self.condition == 'A': self.condition = 'B' return 0 elif self.condition == 'D': self.condition = 'G' return 4 elif self.condition == 'E': self.condition = 'F' return 6 else: raise KeyError def build(self): if self.condition == 'B': self.condition = 'C' return 1 elif self.condition == 'E': self.condition = 'B' return 7 elif self.condition == 'C': self.condition = 'D' return 2 elif self.condition == 'D': self.condition = 'E' return 3 elif self.condition == 'F': self.condition = 'D' return 9 else: raise KeyError def reset(self): if self.condition == 'D': self.condition = 'D' return 5 elif self.condition == 'F': self.condition = 'G' return 8 else: raise KeyError" "class main: def __init__(self): self.word = 'A' def stare(self): if self.word == 'B': self.word = 'E' return 2 elif self.word == 'D': self.word = 'E' return 4 else: raise KeyError() def hoard(self): if self.word == 'D': self.word = 'A' return 5 elif self.word == 'H': self.word = 'C' return 11 elif self.word == 'F': self.word = 'F' return 9 elif self.word == 'G': self.word = 'H' return 10 else: raise KeyError() def slip(self): if self.word == 'A': self.word = 'B' return 0 elif self.word == 'B': self.word = 'C' return 1 elif self.word == 'C': self.word = 'D' return 3 elif self.word == 'D': self.word = 'F' return 6 elif self.word == 'E': self.word = 'F' return 7 elif self.word == 'F': self.word = 'G' return 8 else: raise KeyError()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def share(self): return self.update({State.A: [State.B, 0], State.B: [State.E, 2], State.D: [State.A, 6]}) def crack(self): return self.update({State.B: [State.C, 1], State.D: [State.B, 7], State.C: [State.F, 4]}) def slur(self): return self.update({State.C: [State.D, 3], State.D: [State.E, 5], State.E: [State.F, 8]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main: x = 'a' def fork(self): return self.transition({'a': ['a', 2], 'c': ['d', 4]}) def mix(self): return self.transition({'a': ['b', 0], 'b': ['c', 3], 'd': ['e', 6], 'c': ['e', 5], 'e': ['e', 8]}) def step(self): return self.transition({'a': ['e', 1], 'e': ['f', 7]}) def transition(self, transitions): signal = transitions[self.x][1] self.x = transitions[self.x][0] return signal" "class main: state = 'A' def rock(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': return 3 elif self.state == 'E': self.state = 'A' return 7 else: raise KeyError def exit(self): if self.state == 'B': self.state = 'C' return 1 else: raise KeyError def add(self): if self.state == 'C': self.state = 'D' return 4 elif self.state == 'D': self.state = 'E' return 5 elif self.state == 'E': self.state = 'F' return 6 elif self.state == 'F': self.state = 'D' return 8 elif self.state == 'B': self.state = 'F' return 2 else: raise KeyError" "class M: def __init__(self): self.state = 'A' def wreck(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 1 elif self.state == 'F': self.state = 'C' return 8 elif self.state == 'H': self.state = 'F' return 11 else: raise KeyError def fade(self): if self.state == 'D': self.state = 'B' return 4 elif self.state == 'C': self.state = 'D' return 2 elif self.state == 'E': self.state = 'F' return 5 elif self.state == 'H': self.state = 'D' return 10 else: raise KeyError def crash(self): if self.state == 'D': self.state = 'E' return 3 elif self.state == 'F': self.state = 'G' return 7 elif self.state == 'G': self.state = 'H' return 9 elif self.state == 'E': self.state = 'G' return 6 else: raise KeyError def main(): obj = M() return obj" "class M: def __init__(self): self.state = 'A' def widen(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'C': self.state = 'G' return 5 elif self.state == 'D': self.state = 'E' return 6 elif self.state == 'F': self.state = 'G' return 9 elif self.state == 'B': self.state = 'H' return 2 else: raise KeyError def sit(self): if self.state == 'B': self.state = 'C' return 1 elif self.state == 'E': return 8 else: raise KeyError def rock(self): if self.state == 'B': self.state = 'G' return 3 elif self.state == 'F': self.state = 'B' return 10 elif self.state == 'E': self.state = 'F' return 7 elif self.state == 'G': self.state = 'H' return 11 elif self.state == 'C': self.state = 'D' return 4 else: raise KeyError def main(): obj = M() return obj" "class M: def __init__(self): self.state = 'A' def stare(self): if self.state == 'A': return 1 elif self.state == 'B': self.state = 'F' return 4 elif self.state == 'D': self.state = 'E' return 6 else: raise KeyError def scrub(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'D' return 3 elif self.state == 'E': self.state = 'F' return 7 elif self.state == 'F': self.state = 'G' return 9 elif self.state == 'H': self.state = 'F' return 11 else: raise KeyError def skip(self): if self.state == 'B': self.state = 'C' return 2 elif self.state == 'C': self.state = 'D' return 5 elif self.state == 'E': return 8 elif self.state == 'G': self.state = 'H' return 10 else: raise KeyError def main(): obj = M() return obj" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class StateMachine: state = State.A def mass(self): return self.update({State.A: [State.B, 0], State.B: [State.E, 3], State.C: [State.D, 4], State.E: [State.F, 7]}) def sway(self): return self.update({State.B: [State.C, 1], State.D: [State.F, 6], State.F: [State.G, 8], State.G: [State.C, 9]}) def skip(self): return self.update({State.B: [State.D, 2], State.D: [State.E, 5]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class Hello: __slots__ = ('state',) def __init__(self): self.state = 'A' def sway(self): match self.state: case 'A': self.state = 'B' return 0 case 'B': self.state = 'C' return 1 case 'C': self.state = 'A' return 6 case 'E': self.state = 'F' return 8 case 'F': self.state = 'G' return 9 case _: raise KeyError def visit(self): match self.state: case 'C': self.state = 'G' return 5 case 'G': self.state = 'H' return 10 case 'H': self.state = 'B' return 11 case _: raise KeyError def march(self): match self.state: case 'C': self.state = 'D' return 4 case 'B': self.state = 'D' return 3 case 'D': self.state = 'E' return 7 case _: raise KeyError def file(self): match self.state: case 'B': self.state = 'F' return 2 case _: raise KeyError def main(): return Hello()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def throw(self): return self.update({State.A: [State.B, 0], State.C: [State.D, 2], State.D: [State.F, 5], State.E: [State.G, 7], State.F: [State.F, 10]}) def pluck(self): return self.update({State.B: [State.C, 1], State.C: [State.A, 3]}) def play(self): return self.update({State.D: [State.E, 4], State.E: [State.C, 8], State.F: [State.G, 9]}) def sway(self): return self.update({State.E: [State.F, 6], State.G: [State.H, 11]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main: x = 'a' def chain(self): return self.change({'a': ['b', 0], 'b': ['c', 1], 'd': ['e', 4], 'e': ['b', 7]}) def chip(self): return self.change({'b': ['d', 2], 'c': ['d', 3], 'd': ['a', 5], 'e': ['f', 6], 'f': ['a', 8]}) def change(self, transitions): signal = transitions[self.x][1] self.x = transitions[self.x][0] return signal" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def jog(self): return self.update({State.A: [State.A, 1], State.C: [State.D, 4], State.D: [State.F, 6], State.E: [State.C, 8]}) def walk(self): return self.update({State.A: [State.B, 0], State.E: [State.F, 7]}) def coat(self): return self.update({State.B: [State.C, 3], State.D: [State.E, 5], State.A: [State.F, 2], State.F: [State.G, 9]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class Mili: state = 'A' def spawn(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'E': self.state = 'F' return 7 else: raise KeyError def begin(self): if self.state == 'A': self.state = 'D' return 1 elif self.state == 'D': self.state = 'B' return 6 elif self.state == 'C': self.state = 'D' return 4 elif self.state == 'F': self.state = 'G' return 9 elif self.state == 'H': self.state = 'D' return 11 else: raise KeyError def stay(self): if self.state == 'B': self.state = 'C' return 2 elif self.state == 'E': self.state = 'A' return 8 elif self.state == 'D': self.state = 'E' return 5 else: raise KeyError def fork(self): if self.state == 'B': self.state = 'E' return 3 elif self.state == 'G': self.state = 'H' return 10 else: raise KeyError def main(): return Mili()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def edit(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 2], State.C: [State.D, 3], State.E: [State.F, 5], State.F: [State.G, 6], State.G: [State.E, 7]}) def show(self): return self.update({State.G: [State.D, 9]}) def stare(self): return self.update({State.A: [State.G, 1], State.G: [State.C, 8], State.D: [State.E, 4]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class StateMachine: state = State.A def apply(self): return self.update({State.A: [State.B, 0], State.B: [State.F, 3], State.D: [State.E, 6]}) def skid(self): return self.update({State.B: [State.E, 2], State.C: [State.F, 5], State.F: [State.A, 8]}) def mask(self): return self.update({State.C: [State.D, 4], State.B: [State.C, 1], State.E: [State.F, 7]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class StateMachine: state = State.A def add(self): return self.update({State.A: [State.B, 0], State.B: [State.B, 2], State.D: [State.E, 6], State.C: [State.F, 4]}) def show(self): return self.update({State.B: [State.C, 1], State.C: [State.D, 3], State.D: [State.D, 7]}) def stash(self): return self.update({State.C: [State.A, 5], State.E: [State.F, 8]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def lower(self): return self.update({State.B: [State.C, 1], State.F: [State.G, 8], State.D: [State.E, 4], State.G: [State.D, 10], State.E: [State.B, 7]}) def mass(self): return self.update({State.A: [State.B, 0], State.B: [State.B, 2], State.D: [State.H, 5], State.E: [State.F, 6], State.G: [State.H, 9], State.C: [State.D, 3], State.H: [State.H, 11]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class StateMachine: state = State.A def rev(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 2], State.C: [State.E, 4], State.D: [State.E, 5], State.E: [State.A, 7]}) def run(self): return self.update({State.A: [State.F, 1], State.C: [State.D, 3], State.E: [State.F, 6], State.F: [State.G, 8], State.G: [State.C, 9]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class Machine: state = State.A def pluck(self): return self.update({State.A: [State.B, 0], State.B: [State.B, 4], State.C: [State.D, 5], State.D: [State.F, 7]}) def scale(self): return self.update({State.B: [State.F, 3], State.D: [State.E, 6], State.E: [State.F, 8], State.A: [State.C, 1]}) def coast(self): return self.update({State.B: [State.C, 2]}) def update(self, trans): (self.state, signal) = trans[self.state] return signal def main(): return Machine()" "class main: def __init__(self): self.condition = 'A' def slur(self): if self.condition == 'A': self.condition = 'B' return 0 elif self.condition == 'D': self.condition = 'A' return 6 elif self.condition == 'E': self.condition = 'F' return 7 elif self.condition == 'C': self.condition = 'G' return 3 else: raise KeyError def tread(self): if self.condition == 'C': self.condition = 'D' return 2 elif self.condition == 'D': self.condition = 'E' return 5 elif self.condition == 'F': self.condition = 'B' return 9 elif self.condition == 'H': self.condition = 'B' return 11 else: raise KeyError def load(self): if self.condition == 'B': self.condition = 'C' return 1 elif self.condition == 'C': self.condition = 'E' return 4 elif self.condition == 'F': self.condition = 'G' return 8 elif self.condition == 'G': self.condition = 'H' return 10 else: raise KeyError" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class StateMachine: state = State.A def join(self): return self.update({State.A: [State.B, 0], State.B: [State.G, 3], State.D: [State.E, 5], State.F: [State.G, 8]}) def amble(self): return self.update({State.B: [State.C, 1], State.G: [State.C, 9], State.E: [State.F, 7], State.D: [State.F, 6]}) def push(self): return self.update({State.B: [State.F, 2], State.C: [State.D, 4]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main: def __init__(self): self.__state = 'A' def fill(self): if self.__state == 'A': self.__state = 'B' return 0 if self.__state == 'B': self.__state = 'C' return 1 if self.__state == 'C': self.__state = 'D' return 3 raise KeyError def run(self): if self.__state == 'D': self.__state = 'G' return 6 if self.__state == 'G': self.__state = 'H' return 11 if self.__state == 'F': self.__state = 'G' return 9 if self.__state == 'E': self.__state = 'F' return 7 raise KeyError def rush(self): if self.__state == 'E': self.__state = 'B' return 8 if self.__state == 'C': self.__state = 'H' return 4 if self.__state == 'D': self.__state = 'E' return 5 if self.__state == 'F': self.__state = 'A' return 10 raise KeyError def check(self): if self.__state == 'B': self.__state = 'H' return 2 raise KeyError" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def mass(self): return self.update({State.A: [State.B, 0], State.D: [State.F, 5], State.E: [State.F, 6], State.G: [State.H, 9]}) def check(self): return self.update({State.A: [State.H, 1], State.B: [State.C, 2], State.C: [State.D, 3], State.D: [State.E, 4], State.E: [State.C, 7], State.F: [State.G, 8], State.G: [State.D, 11]}) def click(self): return self.update({State.G: [State.C, 10]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class Machine: state = 'A' def rev(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'E': self.state = 'F' return 6 elif self.state == 'F': self.state = 'G' return 7 else: raise KeyError def stash(self): if self.state == 'A': self.state = 'H' return 1 elif self.state == 'B': return 3 elif self.state == 'C': self.state = 'D' return 4 elif self.state == 'D': self.state = 'E' return 5 elif self.state == 'F': self.state = 'B' return 9 elif self.state == 'G': self.state = 'H' return 10 elif self.state == 'H': self.state = 'F' return 11 else: raise KeyError def spawn(self): if self.state == 'B': self.state = 'C' return 2 elif self.state == 'F': return 8 else: raise KeyError def main(): return Machine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def show(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 2], State.D: [State.D, 6]}) def step(self): return self.update({State.B: [State.B, 3], State.C: [State.D, 4], State.H: [State.D, 10], State.E: [State.F, 7]}) def lower(self): return self.update({State.A: [State.C, 1], State.D: [State.E, 5], State.F: [State.G, 8], State.G: [State.H, 9], State.H: [State.A, 11]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class State: current_state = 20 def update(obj={}): fun_state = State.current_state State.current_state = obj[State.current_state] return obj[fun_state] class main: def step(self): result = State.update(obj={20: 0, 0: 2, 2: 5, 4: 7, 6: 8, 7: 2, 5: 0}) return result def clean(self): result = State.update(obj={20: 1, 2: 4, 4: 6, 8: 9, 0: 3, 7: 3, 5: 1}) return result" "class main: def __init__(self): self.__state = 'A' def place(self): if self.__state == 'A': self.__state = 'B' return 0 if self.__state == 'B': self.__state = 'C' return 2 if self.__state == 'C': self.__state = 'D' return 4 if self.__state == 'D': self.__state = 'E' return 6 raise KeyError def view(self): if self.__state == 'A': self.__state = 'D' return 1 if self.__state == 'C': return 5 if self.__state == 'B': self.__state = 'F' return 3 if self.__state == 'D': self.__state = 'F' return 7 if self.__state == 'E': self.__state = 'F' return 8 raise KeyError" "class Machine: state = 'A' def crack(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 2 elif self.state == 'C': self.state = 'D' return 3 elif self.state == 'D': self.state = 'E' return 4 elif self.state == 'E': self.state = 'F' return 6 elif self.state == 'G': self.state = 'B' return 9 else: raise KeyError def step(self): if self.state == 'A': return 1 elif self.state == 'F': self.state = 'G' return 7 elif self.state == 'G': self.state = 'E' return 10 else: raise KeyError def paint(self): if self.state == 'D': return 5 elif self.state == 'G': self.state = 'H' return 8 elif self.state == 'H': self.state = 'D' return 11 else: raise KeyError def main(): return Machine()" "class main: def __init__(self): self.__state = 'A' def color(self): if self.__state == 'A': self.__state = 'B' return 0 if self.__state == 'B': self.__state = 'C' return 1 if self.__state == 'C': self.__state = 'E' return 5 if self.__state == 'F': return 9 raise KeyError def join(self): if self.__state == 'C': self.__state = 'D' return 3 if self.__state == 'D': self.__state = 'E' return 6 if self.__state == 'E': self.__state = 'F' return 7 if self.__state == 'F': self.__state = 'G' return 8 if self.__state == 'B': self.__state = 'E' return 2 raise KeyError def file(self): if self.__state == 'C': self.__state = 'G' return 4 raise KeyError" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def clean(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 3], State.C: [State.D, 5], State.E: [State.F, 7], State.F: [State.G, 8]}) def glare(self): return self.update({State.A: [State.C, 2]}) def spin(self): return self.update({State.A: [State.F, 1], State.B: [State.F, 4], State.G: [State.H, 9], State.H: [State.C, 11]}) def make(self): return self.update({State.D: [State.E, 6], State.G: [State.E, 10]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class StateMachine: state = State.A def race(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 1], State.C: [State.A, 3], State.E: [State.G, 7], State.F: [State.F, 9]}) def coat(self): return self.update({State.C: [State.D, 2]}) def look(self): return self.update({State.C: [State.F, 4], State.D: [State.E, 5], State.E: [State.F, 6], State.F: [State.G, 8]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main: def __init__(self): self.curr_state = 'A' self.states = {'A': ['B', 'C', None, None], 'B': ['H', 'C', None, None], 'C': ['G', None, 'D', None], 'D': [None, None, 'E', None], 'E': [None, None, None, 'F'], 'F': [None, 'G', None, None], 'G': ['B', 'H', None, 'E'], 'H': [None, None, None, None]} self.state_key = {'A': [0, 1], 'B': [3, 2], 'C': [5, None, 4], 'D': [None, None, 6], 'E': [None, None, None, 7], 'F': [None, 8], 'G': [11, 9, None, 10], 'H': [None]} def put(self): if self.states[self.curr_state][0]: last_state = self.curr_state self.curr_state = self.states[self.curr_state][0] return self.state_key[last_state][0] raise KeyError() def post(self): if self.states[self.curr_state][1]: last_state = self.curr_state self.curr_state = self.states[self.curr_state][1] return self.state_key[last_state][1] raise KeyError() def mute(self): if self.states[self.curr_state][2]: last_state = self.curr_state self.curr_state = self.states[self.curr_state][2] return self.state_key[last_state][2] raise KeyError() def clear(self): if self.states[self.curr_state][3]: last_state = self.curr_state self.curr_state = self.states[self.curr_state][3] return self.state_key[last_state][3] raise KeyError()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def stare(self): return self.update({State.A: [State.B, 0], State.C: [State.D, 6], State.B: [State.G, 4], State.F: [State.G, 9]}) def load(self): return self.update({State.B: [State.C, 2], State.G: [State.H, 11]}) def peek(self): return self.update({State.A: [State.D, 1], State.E: [State.F, 8], State.B: [State.B, 5]}) def group(self): return self.update({State.B: [State.D, 3], State.D: [State.E, 7], State.F: [State.F, 10]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class StateMachine: state = 'A' def tweak(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'D': self.state = 'A' return 5 else: raise KeyError def erase(self): if self.state == 'B': self.state = 'C' return 1 elif self.state == 'E': self.state = 'F' return 6 elif self.state == 'D': self.state = 'E' return 3 else: raise KeyError def open(self): if self.state == 'C': self.state = 'D' return 2 elif self.state == 'E': self.state = 'C' return 7 elif self.state == 'F': self.state = 'C' return 8 elif self.state == 'D': self.state = 'B' return 4 else: raise KeyError def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class main: state = State.A def show(self): return self.update({State.B: [State.C, 1], State.D: [State.E, 5], State.C: [State.E, 4], State.E: [State.G, 7], State.H: [State.C, 11], State.G: [State.H, 9]}) def stash(self): return self.update({State.A: [State.B, 0], State.B: [State.D, 2], State.C: [State.D, 3], State.E: [State.F, 6], State.F: [State.G, 8], State.G: [State.G, 10]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal" "import math class main: def __init__(self): self.state = 'A' def herd(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'C': self.state = 'D' return 3 elif self.state == 'E': self.state = 'F' return 7 else: raise KeyError def view(self): if self.state == 'B': self.state = 'D' return 2 elif self.state == 'C': self.state = 'A' return 4 elif self.state == 'F': self.state = 'B' return 8 else: raise KeyError def order(self): if self.state == 'B': self.state = 'C' return 1 elif self.state == 'C': return 5 elif self.state == 'D': self.state = 'E' return 6 else: raise KeyError" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class StateMachine: state = State.A def load(self): return self.update({State.A: [State.B, 0], State.B: [State.F, 3]}) def peek(self): return self.update({State.B: [State.C, 1], State.D: [State.E, 5], State.E: [State.C, 8]}) def split(self): return self.update({State.B: [State.E, 2], State.C: [State.D, 4], State.D: [State.A, 6], State.E: [State.F, 7]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main: def __init__(self): self.condition = 'A' def unite(self): if self.condition == 'A': self.condition = 'B' return 0 elif self.condition == 'E': self.condition = 'F' return 5 elif self.condition == 'G': self.condition = 'D' return 9 else: raise KeyError def mass(self): if self.condition == 'B': self.condition = 'C' return 1 elif self.condition == 'C': self.condition = 'D' return 3 elif self.condition == 'D': self.condition = 'E' return 4 elif self.condition == 'E': self.condition = 'G' return 6 elif self.condition == 'G': self.condition = 'B' return 8 else: raise KeyError def widen(self): if self.condition == 'B': self.condition = 'E' return 2 elif self.condition == 'F': self.condition = 'G' return 7 else: raise KeyError" "class Mily: statements = ['A', 'B', 'C', 'D', 'E', 'F', 'G'] current_statement = 'A' num_change = None def copy(self): if self.current_statement == 'A': self.num_change = 0 self.current_statement = 'B' elif self.current_statement == 'B': self.num_change = 1 self.current_statement = 'C' elif self.current_statement == 'D': self.num_change = 7 self.current_statement = 'B' elif self.current_statement == 'F': self.num_change = 9 self.current_statement = 'G' elif self.current_statement == 'G': self.num_change = 10 self.current_statement = 'H' else: raise KeyError return self.num_change def sit(self): if self.current_statement == 'B': self.num_change = 2 self.current_statement = 'F' elif self.current_statement == 'D': self.num_change = 6 self.current_statement = 'E' elif self.current_statement == 'C': self.num_change = 4 self.current_statement = 'D' else: raise KeyError return self.num_change def melt(self): if self.current_statement == 'C': self.num_change = 5 self.current_statement = 'C' elif self.current_statement == 'B': self.num_change = 3 self.current_statement = 'B' elif self.current_statement == 'E': self.num_change = 8 self.current_statement = 'F' elif self.current_statement == 'H': self.num_change = 11 self.current_statement = 'F' else: raise KeyError return self.num_change def main(): m = Mily() return m" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class StateMachine: state = State.A def chalk(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 2], State.C: [State.E, 4], State.E: [State.F, 6]}) def pull(self): return self.update({State.A: [State.F, 1], State.F: [State.B, 8], State.E: [State.B, 7], State.C: [State.D, 3], State.D: [State.E, 5]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main: def __init__(self): self.__state = 'A' def sweep(self): if self.__state == 'A': self.__state = 'B' return 0 if self.__state == 'D': self.__state = 'A' return 6 if self.__state == 'B': self.__state = 'F' return 3 if self.__state == 'E': self.__state = 'A' return 8 raise KeyError def forge(self): if self.__state == 'B': self.__state = 'C' return 2 if self.__state == 'C': self.__state = 'D' return 4 if self.__state == 'E': self.__state = 'F' return 7 raise KeyError def march(self): if self.__state == 'A': self.__state = 'F' return 1 if self.__state == 'D': self.__state = 'E' return 5 raise KeyError" "class main: def __init__(self): self.condition = 'A' def push(self): if self.condition == 'A': self.condition = 'B' return 0 elif self.condition == 'C': self.condition = 'A' return 5 elif self.condition == 'D': self.condition = 'E' return 6 else: raise KeyError def trash(self): if self.condition == 'A': self.condition = 'D' return 1 elif self.condition == 'D': self.condition = 'F' return 7 elif self.condition == 'E': self.condition = 'F' return 8 elif self.condition == 'F': self.condition = 'G' return 9 else: raise KeyError def bolt(self): if self.condition == 'B': self.condition = 'C' return 3 elif self.condition == 'C': self.condition = 'D' return 4 elif self.condition == 'A': self.condition = 'F' return 2 else: raise KeyError" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class StateMachine: state = State.A def place(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 3], State.C: [State.C, 6]}) def jog(self): return self.update({State.A: [State.C, 1], State.B: [State.E, 4], State.C: [State.D, 5], State.F: [State.G, 9]}) def move(self): return self.update({State.A: [State.A, 2], State.D: [State.E, 7], State.E: [State.F, 8]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class StateMachine: state = State.A def cull(self): return self.update({State.A: [State.A, 2], State.D: [State.E, 6], State.E: [State.F, 8]}) def hike(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 3], State.C: [State.E, 5], State.D: [State.D, 7]}) def carve(self): return self.update({State.A: [State.E, 1], State.C: [State.D, 4]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main: def __init__(self): self.name = 'A' def apply(self): if self.name == 'A': self.name = 'B' return 0 elif self.name == 'D': self.name = 'E' return 3 elif self.name == 'E': self.name = 'F' return 5 if self.name == 'F': return 9 else: raise KeyError def sit(self): if self.name == 'D': self.name = 'A' return 4 elif self.name == 'F': self.name = 'B' return 8 elif self.name == 'C': self.name = 'D' return 2 elif self.name == 'E': return 6 else: raise KeyError def dash(self): if self.name == 'B': self.name = 'C' return 1 elif self.name == 'F': self.name = 'G' return 7 else: raise KeyError" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class main: state = State.A def boost(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 2], State.C: [State.D, 3], State.E: [State.G, 7]}) def add(self): return self.update({State.A: [State.G, 1], State.D: [State.E, 4], State.E: [State.E, 6]}) def put(self): return self.update({State.E: [State.F, 5], State.G: [State.B, 9], State.F: [State.G, 8]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal" "class Machine: def __init__(self): self.states = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H'] self.state = self.states[0] def clone(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 2 elif self.state == 'C': self.state = 'D' return 4 elif self.state == 'D': self.state = 'E' return 5 elif self.state == 'E': self.state = 'F' return 6 elif self.state == 'F': self.state = 'D' return 9 else: raise KeyError def paste(self): if self.state == 'A': self.state = 'F' return 1 elif self.state == 'F': self.state = 'G' return 8 elif self.state == 'G': self.state = 'H' return 10 elif self.state == 'H': self.state = 'F' return 11 elif self.state == 'B': self.state = 'G' return 3 elif self.state == 'E': self.state = 'H' return 7 else: raise KeyError def main(): return Machine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def skid(self): return self.update({State.A: [State.B, 0], State.C: [State.D, 2], State.D: [State.E, 3], State.E: [State.F, 4], State.F: [State.G, 6], State.G: [State.A, 10]}) def base(self): return self.update({State.B: [State.C, 1], State.E: [State.E, 5], State.F: [State.F, 7], State.G: [State.E, 9]}) def order(self): return self.update({State.G: [State.H, 8], State.H: [State.B, 11]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class StateMachine: state = State.A def tweak(self): return self.update({State.A: [State.B, 0], State.D: [State.E, 6]}) def slur(self): return self.update({State.A: [State.E, 1], State.B: [State.C, 3], State.C: [State.D, 4], State.E: [State.E, 8], State.F: [State.G, 9]}) def add(self): return self.update({State.A: [State.D, 2], State.C: [State.A, 5], State.E: [State.F, 7]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def sway(self): return self.update({State.A: [State.B, 0], State.C: [State.D, 3], State.G: [State.D, 10]}) def run(self): return self.update({State.A: [State.A, 1], State.D: [State.E, 5], State.F: [State.G, 7], State.G: [State.H, 8]}) def debug(self): return self.update({State.B: [State.C, 2], State.E: [State.F, 6], State.G: [State.B, 9]}) def code(self): return self.update({State.C: [State.C, 4], State.G: [State.A, 11]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main: def __init__(self): self.condition = 'A' def tag(self): if self.condition == 'A': self.condition = 'B' return 0 elif self.condition == 'B': self.condition = 'B' return 4 elif self.condition == 'E': self.condition = 'F' return 7 else: raise KeyError def log(self): if self.condition == 'A': self.condition = 'A' return 1 else: raise KeyError def make(self): if self.condition == 'A': self.condition = 'C' return 2 elif self.condition == 'B': self.condition = 'C' return 3 elif self.condition == 'C': self.condition = 'D' return 5 elif self.condition == 'D': self.condition = 'E' return 6 elif self.condition == 'E': self.condition = 'C' return 8 elif self.condition == 'F': self.condition = 'G' return 9 else: raise KeyError" "class main: a = 'A' def share(self): if self.a == 'A': self.a = 'B' return 0 if self.a == 'B': self.a = 'E' return 3 if self.a == 'D': self.a = 'E' return 5 if self.a == 'E': self.a = 'F' return 8 if self.a == 'F': self.a = 'G' return 10 raise KeyError def spawn(self): if self.a == 'B': self.a = 'C' return 1 if self.a == 'C': self.a = 'D' return 4 if self.a == 'D': self.a = 'G' return 6 raise KeyError def rock(self): if self.a == 'B': self.a = 'G' return 2 if self.a == 'D': return 7 if self.a == 'E': self.a = 'H' return 9 if self.a == 'G': self.a = 'H' return 11 raise KeyError" "class main: def __init__(self): self.condition = 'A' def shade(self): if self.condition == 'A': self.condition = 'B' return 0 elif self.condition == 'B': self.condition = 'C' return 1 elif self.condition == 'C': self.condition = 'D' return 3 elif self.condition == 'D': self.condition = 'E' return 5 elif self.condition == 'E': self.condition = 'E' return 8 elif self.condition == 'F': self.condition = 'G' return 9 else: raise KeyError def file(self): if self.condition == 'B': self.condition = 'E' return 2 elif self.condition == 'E': self.condition = 'F' return 7 elif self.condition == 'C': self.condition = 'C' return 4 elif self.condition == 'D': self.condition = 'H' return 6 elif self.condition == 'G': self.condition = 'H' return 11 elif self.condition == 'F': self.condition = 'B' return 10 else: raise KeyError" "class Miles_FSM: def __init__(self): self.state = 'A' def apply(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'C': return 6 elif self.state == 'B': self.state = 'H' return 2 else: raise KeyError def group(self): if self.state == 'G': self.state = 'H' return 10 elif self.state == 'B': self.state = 'D' return 4 else: raise KeyError def wreck(self): if self.state == 'B': return 3 elif self.state == 'C': self.state = 'D' return 5 elif self.state == 'F': self.state = 'G' return 9 elif self.state == 'G': return 11 else: raise KeyError def forge(self): if self.state == 'B': self.state = 'C' return 1 elif self.state == 'D': self.state = 'E' return 7 elif self.state == 'E': self.state = 'F' return 8 else: raise KeyError def main(): obj = Miles_FSM() return obj" "from enum import Enum, auto class State(Enum): A = auto() B = auto() C = auto() D = auto() E = auto() F = auto() def main(): return Main() class Main: def __init__(self) -> None: self.state = State.A def color(self): match self.state: case State.A: self.state = State.B return 0 case State.D: self.state = State.E return 3 case State.E: self.state = State.F return 6 case State.F: self.state = State.B return 8 case State.B: raise KeyError() case State.C: raise KeyError() def cut(self): match self.state: case State.B: self.state = State.C return 1 case State.D: self.state = State.F return 5 case State.A: raise KeyError() case State.C: raise KeyError() case State.E: raise KeyError() case State.F: raise KeyError() def stare(self): match self.state: case State.C: self.state = State.D return 2 case State.D: self.state = State.B return 4 case State.E: self.state = State.E return 7 case State.A: raise KeyError() case State.B: raise KeyError() case State.F: raise KeyError()" "class main: def __init__(self): self.condition = 'A' def crush(self): if self.condition == 'A': self.condition = 'B' return 0 elif self.condition == 'D': self.condition = 'B' return 6 else: raise KeyError def visit(self): if self.condition == 'A': self.condition = 'D' return 2 elif self.condition == 'B': self.condition = 'C' return 3 elif self.condition == 'C': self.condition = 'D' return 4 elif self.condition == 'D': self.condition = 'E' return 5 elif self.condition == 'F': self.condition = 'C' return 8 else: raise KeyError def bend(self): if self.condition == 'A': self.condition = 'E' return 1 elif self.condition == 'E': self.condition = 'F' return 7 else: raise KeyError" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class StateMachine: state = State.A def forge(self): return self.update({State.A: [State.A, 1], State.C: [State.D, 4], State.D: [State.E, 6], State.F: [State.F, 8], State.B: [State.F, 3]}) def peep(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 2], State.C: [State.C, 5], State.E: [State.F, 7]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def fetch(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 1], State.C: [State.G, 3], State.F: [State.G, 7]}) def dash(self): return self.update({State.F: [State.A, 9], State.D: [State.F, 5], State.E: [State.F, 6]}) def sit(self): return self.update({State.C: [State.D, 2], State.D: [State.E, 4], State.F: [State.C, 8]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main: def __init__(self): self.currentPoint = 'A' def clone(self): match self.currentPoint: case 'A': self.currentPoint = 'B' return 0 case 'D': self.currentPoint = 'E' return 4 case 'F': self.currentPoint = 'F' return 8 case 'G': self.currentPoint = 'A' return 11 case _: raise KeyError def run(self): match self.currentPoint: case 'A': self.currentPoint = 'D' return 1 case 'B': self.currentPoint = 'C' return 2 case 'E': self.currentPoint = 'F' return 5 case 'F': self.currentPoint = 'B' return 9 case 'G': self.currentPoint = 'H' return 10 case _: raise KeyError def stand(self): match self.currentPoint: case 'C': self.currentPoint = 'D' return 3 case 'E': self.currentPoint = 'B' return 6 case 'F': self.currentPoint = 'G' return 7 case _: raise KeyError" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class StateMachine: state = State.A def slip(self): return self.update({State.A: [State.B, 0], State.C: [State.D, 3], State.D: [State.E, 5], State.E: [State.F, 7], State.F: [State.B, 9]}) def walk(self): return self.update({State.A: [State.C, 1], State.B: [State.C, 2], State.C: [State.C, 4], State.D: [State.A, 6], State.F: [State.G, 8]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class StateMachine: state = State.A def stare(self): return self.update({State.A: [State.B, 0], State.C: [State.D, 2], State.D: [State.E, 4], State.E: [State.E, 6], State.F: [State.A, 9]}) def jump(self): return self.update({State.B: [State.C, 1], State.C: [State.E, 3], State.F: [State.F, 8]}) def init(self): return self.update({State.E: [State.F, 5], State.F: [State.G, 7]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main: def __init__(self): self.condition = 'A' def slur(self): if self.condition == 'A': self.condition = 'B' return 0 elif self.condition == 'B': self.condition = 'C' return 2 elif self.condition == 'C': self.condition = 'D' return 4 elif self.condition == 'E': self.condition = 'F' return 6 elif self.condition == 'F': self.condition = 'G' return 7 elif self.condition == 'G': self.condition = 'E' return 9 else: raise KeyError def carve(self): if self.condition == 'A': self.condition = 'F' return 1 elif self.condition == 'F': self.condition = 'B' return 8 elif self.condition == 'F': self.condition = 'B' return 8 elif self.condition == 'B': self.condition = 'G' return 3 elif self.condition == 'D': self.condition = 'E' return 5 else: raise KeyError" "class main: state = 'A' answer = {'A': {'peep': ['B', 0]}, 'B': {'peep': ['C', 1], 'apply': ['F', 2]}, 'C': {'peep': ['E', 4], 'apply': ['D', 3]}, 'D': {'peep': ['E', 5]}, 'E': {'peep': ['B', 7], 'apply': ['F', 6]}, 'F': {'apply': ['F', 8]}} def peep(self): res = self.answer[self.state]['peep'] self.state = res[0] return res[1] def apply(self): res = self.answer[self.state]['apply'] self.state = res[0] return res[1]" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class StateMachine: state = State.A def tag(self): return self.update({State.A: [State.B, 0], State.D: [State.A, 6], State.E: [State.F, 7], State.F: [State.A, 9]}) def flip(self): return self.update({State.A: [State.E, 1], State.B: [State.C, 2], State.D: [State.E, 5]}) def zoom(self): return self.update({State.B: [State.E, 3], State.C: [State.D, 4], State.F: [State.G, 8]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class StateMachine: state = State.A def throw(self): return self.update({State.A: [State.A, 1], State.D: [State.E, 6]}) def start(self): return self.update({State.A: [State.B, 0], State.C: [State.E, 5]}) def punch(self): return self.update({State.A: [State.F, 2], State.B: [State.C, 3], State.C: [State.D, 4], State.E: [State.F, 7], State.F: [State.B, 8]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class StateMachine: state = State.A def show(self): return self.update({State.A: [State.B, 0], State.B: [State.F, 3], State.C: [State.D, 4], State.D: [State.E, 5], State.E: [State.F, 7]}) def race(self): return self.update({State.B: [State.B, 2]}) def cast(self): return self.update({State.B: [State.C, 1], State.D: [State.B, 6], State.F: [State.A, 8]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class StateMachine: state = State.A def skid(self): return self.update({State.A: [State.B, 0], State.C: [State.D, 2], State.E: [State.F, 7]}) def cull(self): return self.update({State.B: [State.C, 1], State.C: [State.A, 4], State.D: [State.E, 5], State.E: [State.E, 8]}) def model(self): return self.update({State.C: [State.E, 3], State.D: [State.D, 6]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class A: state = 'A' def cast(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 2 elif self.state == 'C': self.state = 'C' return 4 elif self.state == 'D': self.state = 'E' return 5 elif self.state == 'E': self.state = 'F' return 6 elif self.state == 'F': self.state = 'F' return 7 else: raise KeyError def model(self): if self.state == 'A': self.state = 'C' return 1 elif self.state == 'C': self.state = 'D' return 3 elif self.state == 'F': self.state = 'A' return 8 else: raise KeyError def main(): return A()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def sweep(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 1], State.E: [State.F, 7], State.C: [State.A, 5]}) def swap(self): return self.update({State.B: [State.D, 2], State.C: [State.C, 4], State.D: [State.E, 6], State.F: [State.G, 9]}) def crack(self): return self.update({State.C: [State.D, 3], State.E: [State.G, 8]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class StateMachine: state = State.A def mask(self): return self.update({State.A: [State.B, 0], State.D: [State.F, 5], State.E: [State.F, 6]}) def spin(self): return self.update({State.B: [State.C, 1], State.C: [State.D, 2], State.D: [State.B, 4], State.E: [State.A, 7], State.F: [State.G, 8], State.G: [State.B, 9]}) def tweak(self): return self.update({State.D: [State.E, 3]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def skew(self): return self.update({State.A: [State.B, 0], State.B: [State.B, 5], State.C: [State.D, 6]}) def bolt(self): return self.update({State.A: [State.C, 1], State.B: [State.C, 2]}) def stay(self): return self.update({State.B: [State.F, 4], State.E: [State.F, 8]}) def type(self): return self.update({State.B: [State.E, 3], State.D: [State.E, 7]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class StateMachine: state = State.A def apply(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 3], State.C: [State.D, 4], State.D: [State.E, 5]}) def race(self): return self.update({State.A: [State.A, 2], State.E: [State.A, 8]}) def slur(self): return self.update({State.A: [State.D, 1], State.D: [State.F, 6], State.E: [State.F, 7]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class StateMachine: state = State.A def skew(self): return self.update({State.A: [State.B, 0], State.B: [State.D, 2], State.C: [State.D, 3], State.D: [State.E, 4], State.E: [State.G, 7]}) def carve(self): return self.update({State.B: [State.C, 1], State.D: [State.D, 5], State.E: [State.F, 6], State.F: [State.G, 8], State.G: [State.G, 9]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class StateMachine: state = State.A def blame(self): return self.update({State.B: [State.C, 1], State.C: [State.D, 3], State.E: [State.B, 7], State.D: [State.E, 5], State.F: [State.D, 8]}) def hurry(self): return self.update({State.A: [State.B, 0], State.B: [State.B, 2], State.C: [State.F, 4], State.E: [State.F, 6]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class Mili: state = 'A' def drag(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 2 elif self.state == 'C': self.state = 'D' return 4 elif self.state == 'D': self.state = 'E' return 5 elif self.state == 'F': self.state = 'G' return 7 elif self.state == 'G': self.state = 'D' return 9 else: raise KeyError def draw(self): if self.state == 'B': self.state = 'B' return 3 elif self.state == 'A': self.state = 'G' return 1 elif self.state == 'E': self.state = 'F' return 6 elif self.state == 'F': self.state = 'C' return 8 else: raise KeyError def main(): return Mili()" "class State: def __init__(self, capacities): self.capacities = capacities class Mili: def __init__(self): self.A = State({'mask': [0, None]}) self.B = State({'walk': [1, None], 'crush': [2, None]}) self.C = State({'mask': [3, None], 'walk': [4, None]}) self.D = State({'trim': [5, None], 'crush': [6, None]}) self.E = State({'mask': [7, None]}) self.F = State({'mask': [8, None]}) self.G = State({'mask': [9, None], 'crush': [10, None]}) self.H = State({'mask': [11, None]}) self.A.capacities['mask'][1] = self.B self.B.capacities['walk'][1] = self.C self.B.capacities['crush'][1] = self.G self.C.capacities['mask'][1] = self.D self.C.capacities['walk'][1] = self.F self.D.capacities['trim'][1] = self.E self.D.capacities['crush'][1] = self.A self.E.capacities['mask'][1] = self.F self.F.capacities['mask'][1] = self.G self.G.capacities['mask'][1] = self.H self.G.capacities['crush'][1] = self.C self.H.capacities['mask'][1] = self.B self.initial_state = self.A def walk(self): if 'walk' not in self.initial_state.capacities: raise KeyError else: value = self.initial_state.capacities['walk'][0] self.initial_state = self.initial_state.capacities['walk'][1] return value def mask(self): if 'mask' not in self.initial_state.capacities: raise KeyError else: value = self.initial_state.capacities['mask'][0] self.initial_state = self.initial_state.capacities['mask'][1] return value def crush(self): if 'crush' not in self.initial_state.capacities: raise KeyError else: value = self.initial_state.capacities['crush'][0] self.initial_state = self.initial_state.capacities['crush'][1] return value def trim(self): if 'trim' not in self.initial_state.capacities: raise KeyError else: value = self.initial_state.capacities['trim'][0] self.initial_state = self.initial_state.capacities['trim'][1] return value def main(): graph = Mili() return graph" "class StateMachine: state = 'A' def fetch(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'D': self.state = 'E' return 4 elif self.state == 'E': self.state = 'G' return 7 elif self.state == 'G': self.state = 'H' return 10 else: raise KeyError def pluck(self): if self.state == 'A': self.state = 'C' return 1 elif self.state == 'C': self.state = 'D' return 3 elif self.state == 'G': self.state = 'B' return 11 else: raise KeyError def tag(self): if self.state == 'E': self.state = 'F' return 6 elif self.state == 'F': self.state = 'G' return 9 elif self.state == 'D': self.state = 'H' return 5 else: raise KeyError def crawl(self): if self.state == 'B': self.state = 'C' return 2 elif self.state == 'E': self.state = 'C' return 8 else: raise KeyError def main(): return StateMachine()" "class main: def __init__(self): self.condition = 'A' def trash(self): if self.condition == 'A': self.condition = 'B' return 0 elif self.condition == 'B': self.condition = 'C' return 1 elif self.condition == 'C': self.condition = 'D' return 3 elif self.condition == 'F': self.condition = 'C' return 9 else: raise KeyError def clean(self): if self.condition == 'B': self.condition = 'B' return 2 elif self.condition == 'D': self.condition = 'D' return 6 elif self.condition == 'C': self.condition = 'E' return 4 elif self.condition == 'E': self.condition = 'F' return 7 else: raise KeyError def paint(self): if self.condition == 'D': self.condition = 'E' return 5 elif self.condition == 'F': self.condition = 'G' return 8 else: raise KeyError" "class main: def __init__(self): self.point = 'A' def mass(self): if self.point == 'C': self.point = 'A' return 5 elif self.point == 'B': self.point = 'E' return 3 elif self.point == 'F': self.point = 'C' return 8 else: raise KeyError def cast(self): if self.point == 'A': self.point = 'B' return 0 elif self.point == 'B': self.point = 'C' return 1 elif self.point == 'C': self.point = 'D' return 4 elif self.point == 'D': self.point = 'E' return 6 elif self.point == 'E': self.point = 'F' return 7 else: raise KeyError def click(self): if self.point == 'B': self.point = 'B' return 2 else: raise KeyError" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def debug(self): return self.update({State.A: [State.B, 0], State.B: [State.B, 2], State.C: [State.E, 4], State.D: [State.E, 5], State.E: [State.F, 6], State.F: [State.G, 8]}) def stand(self): return self.update({State.B: [State.C, 1], State.C: [State.D, 3], State.E: [State.E, 7], State.F: [State.F, 9]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class M: def __init__(self): self.state = 'A' def punch(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'C': self.state = 'D' return 2 elif self.state == 'D': self.state = 'E' return 5 elif self.state == 'E': self.state = 'E' return 7 elif self.state == 'F': self.state = 'G' return 8 else: raise KeyError def drive(self): if self.state == 'B': self.state = 'C' return 1 elif self.state == 'C': self.state = 'A' return 4 else: raise KeyError def skew(self): if self.state == 'C': self.state = 'F' return 3 elif self.state == 'E': self.state = 'F' return 6 elif self.state == 'F': self.state = 'F' return 9 else: raise KeyError def main(): obj = M() return obj" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def init(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 1], State.C: [State.D, 2], State.E: [State.F, 5], State.G: [State.H, 10], State.H: [State.B, 11]}) def rig(self): return self.update({State.E: [State.A, 7], State.F: [State.G, 8]}) def widen(self): return self.update({State.C: [State.C, 3], State.D: [State.E, 4], State.F: [State.D, 9], State.E: [State.E, 6]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class StateMachine: state = 'A' def tag(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'D': return 7 elif self.state == 'E': self.state = 'F' return 8 elif self.state == 'F': self.state = 'G' return 10 elif self.state == 'C': self.state = 'H' return 5 else: raise KeyError def dash(self): if self.state == 'A': self.state = 'D' return 1 elif self.state == 'E': self.state = 'B' return 9 elif self.state == 'C': self.state = 'D' return 3 elif self.state == 'D': self.state = 'E' return 6 else: raise KeyError def sit(self): if self.state == 'B': self.state = 'C' return 2 elif self.state == 'C': self.state = 'G' return 4 elif self.state == 'G': self.state = 'H' return 11 else: raise KeyError def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class StateMachine: state = State.A def split(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 3], State.C: [State.D, 4]}) def open(self): return self.update({State.A: [State.E, 1], State.F: [State.G, 8], State.D: [State.E, 6]}) def mass(self): return self.update({State.A: [State.G, 2], State.C: [State.E, 5], State.F: [State.C, 9], State.E: [State.F, 7]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main: def __init__(self): self.name = 'A' def check(self): if self.name == 'A': self.name = 'B' return 0 elif self.name == 'B': self.name = 'C' return 2 elif self.name == 'C': self.name = 'D' return 4 elif self.name == 'D': self.name = 'E' return 5 elif self.name == 'E': self.name = 'F' return 7 else: raise KeyError def paint(self): if self.name == 'A': self.name = 'F' return 1 elif self.name == 'B': return 3 elif self.name == 'D': self.name = 'A' return 6 elif self.name == 'E': self.name = 'B' return 8 else: raise KeyError" "class main: state = 'A' def unite(self): if self.state == 'A': return 2 elif self.state == 'B': self.state = 'C' return 4 elif self.state == 'E': self.state = 'F' return 7 else: raise KeyError def close(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'D': self.state = 'E' return 6 elif self.state == 'E': return 8 else: raise KeyError def erase(self): if self.state == 'A': self.state = 'C' return 3 else: raise KeyError def run(self): if self.state == 'A': self.state = 'E' return 1 elif self.state == 'C': self.state = 'D' return 5 else: raise KeyError" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class StateMachine: state = State.A def stand(self): return self.update({State.A: [State.B, 0], State.E: [State.B, 8], State.D: [State.E, 6], State.C: [State.D, 3]}) def smash(self): return self.update({State.B: [State.C, 2], State.A: [State.D, 1], State.C: [State.E, 5]}) def show(self): return self.update({State.C: [State.C, 4], State.E: [State.F, 7]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class MealyMachine: state = 'A' def sweep(self): match self.state: case 'A': self.state = 'B' return 0 case 'B': self.state = 'C' return 1 case 'C': self.state = 'E' return 5 case 'E': self.state = 'F' return 7 case 'F': self.state = 'F' return 8 case _: raise KeyError def unite(self): match self.state: case 'B': self.state = 'E' return 3 case 'D': self.state = 'E' return 6 case _: raise KeyError def click(self): match self.state: case 'C': self.state = 'D' return 4 case 'B': self.state = 'F' return 2 case _: raise KeyError def main(): obj = MealyMachine() return obj" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class main: state = State.A def fetch(self): return self.update({State.A: [State.B, 0], State.D: [State.G, 5], State.H: [State.E, 11]}) def trim(self): return self.update({State.A: [State.D, 1], State.B: [State.C, 2], State.D: [State.D, 6], State.F: [State.B, 9]}) def send(self): return self.update({State.E: [State.F, 7], State.G: [State.H, 10], State.F: [State.G, 8], State.C: [State.D, 3], State.D: [State.E, 4]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class StateMachine: state = State.A def put(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 2], State.C: [State.D, 3], State.D: [State.E, 4], State.E: [State.A, 6], State.F: [State.G, 7], State.G: [State.G, 9]}) def jump(self): return self.update({State.A: [State.D, 1], State.E: [State.F, 5], State.F: [State.B, 8]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class StateMachine: state = State.A def flip(self): return self.update({State.A: [State.B, 0], State.C: [State.D, 3]}) def code(self): return self.update({State.A: [State.C, 1], State.B: [State.C, 2], State.D: [State.E, 5], State.C: [State.F, 4], State.E: [State.F, 7], State.F: [State.A, 9]}) def blame(self): return self.update({State.D: [State.G, 6], State.F: [State.G, 8]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main: def __init__(self): self.status = 'A' def etch(self): match self.status: case 'A': self.status = 'B' return 0 case 'C': self.status = 'D' return 3 case 'D': self.status = 'G' return 7 case _: raise KeyError def code(self): match self.status: case 'A': self.status = 'D' return 1 case 'D': self.status = 'B' return 6 case 'B': self.status = 'C' return 2 case 'C': self.status = 'E' return 4 case 'E': self.status = 'F' return 8 case _: raise KeyError def turn(self): match self.status: case 'D': self.status = 'E' return 5 case 'F': self.status = 'G' return 9 case _: raise KeyError" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class StateMachine: state = State.A def play(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 1], State.D: [State.E, 4], State.E: [State.F, 7]}) def place(self): return self.update({State.B: [State.F, 2], State.D: [State.B, 5]}) def scan(self): return self.update({State.C: [State.D, 3], State.D: [State.A, 6], State.E: [State.C, 8]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main: def __init__(self): self.state: main.State = main.A(self) def widen(self) -> int: return self.state.widen() def sort(self) -> int: return self.state.sort() def rush(self) -> int: return self.state.rush() class State: def __init__(self, parent): self.parent: main = parent def widen(self): raise KeyError def sort(self): raise KeyError def rush(self): raise KeyError class A(State): def widen(self): self.parent.state = main.B(self.parent) return 0 def sort(self): self.parent.state = main.C(self.parent) return 1 def rush(self): self.parent.state = main.E(self.parent) return 2 class B(State): def rush(self): self.parent.state = main.C(self.parent) return 3 def widen(self): self.parent.state = main.F(self.parent) return 4 def sort(self): self.parent.state = main.B(self.parent) return 5 class C(State): def widen(self): self.parent.state = main.D(self.parent) return 6 class D(State): def sort(self): self.parent.state = main.E(self.parent) return 7 class E(State): def widen(self): self.parent.state = main.F(self.parent) return 8 class F(State): pass" "class main: def __init__(self): self.condition = 'A' def erase(self): if self.condition == 'A': self.condition = 'B' return 0 elif self.condition == 'C': self.condition = 'C' return 5 elif self.condition == 'B': self.condition = 'D' return 3 elif self.condition == 'F': self.condition = 'B' return 8 else: raise KeyError def trim(self): if self.condition == 'A': self.condition = 'A' return 1 elif self.condition == 'B': self.condition = 'C' return 2 elif self.condition == 'C': self.condition = 'D' return 4 elif self.condition == 'D': self.condition = 'E' return 6 elif self.condition == 'E': self.condition = 'F' return 7 else: raise KeyError" "class main: def __init__(self): self.state = 'A' def cast(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'C': self.state = 'C' return 4 elif self.state == 'D': self.state = 'E' return 5 else: raise KeyError() def stash(self): if self.state == 'B': self.state = 'C' return 2 elif self.state == 'C': self.state = 'D' return 3 elif self.state == 'E': self.state = 'F' return 7 elif self.state == 'F': self.state = 'D' return 8 elif self.state == 'A': self.state = 'D' return 1 elif self.state == 'D': self.state = 'D' return 6 else: raise KeyError() def main(self): return main()" "class A: state = 'A' def blame(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'C': self.state = 'D' return 6 elif self.state == 'F': self.state = 'G' return 10 else: raise KeyError def split(self): if self.state == 'A': self.state = 'E' return 1 else: raise KeyError def show(self): if self.state == 'A': self.state = 'G' return 2 elif self.state == 'D': self.state = 'E' return 8 elif self.state == 'E': self.state = 'F' return 9 else: raise KeyError def sweep(self): if self.state == 'A': self.state = 'H' return 3 elif self.state == 'G': self.state = 'H' return 11 else: raise KeyError def chat(self): if self.state == 'A': self.state = 'C' return 4 elif self.state == 'B': self.state = 'C' return 5 elif self.state == 'C': self.state = 'G' return 7 else: raise KeyError def main(): return A()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class StateMachine: state = State.A def jog(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 1], State.C: [State.F, 3], State.E: [State.F, 6]}) def share(self): return self.update({State.C: [State.A, 4], State.E: [State.A, 7]}) def post(self): return self.update({State.F: [State.B, 8], State.D: [State.E, 5], State.C: [State.D, 2]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main: def __init__(self): self.condition = 'A' def load(self): if self.condition == 'A': self.condition = 'B' return 0 elif self.condition == 'B': self.condition = 'C' return 2 elif self.condition == 'C': self.condition = 'D' return 4 elif self.condition == 'F': self.condition = 'C' return 9 elif self.condition == 'D': self.condition = 'E' return 5 elif self.condition == 'E': self.condition = 'F' return 7 else: raise KeyError def close(self): if self.condition == 'A': self.condition = 'D' return 1 elif self.condition == 'D': self.condition = 'F' return 6 elif self.condition == 'F': self.condition = 'G' return 8 elif self.condition == 'B': self.condition = 'G' return 3 else: raise KeyError" "class Mili: state = 'A' def paint(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 1 elif self.state == 'E': self.state = 'C' return 5 elif self.state == 'F': self.state = 'G' return 6 else: raise KeyError def scan(self): if self.state == 'F': self.state = 'B' return 7 elif self.state == 'C': self.state = 'D' return 2 else: raise KeyError def place(self): if self.state == 'D': self.state = 'E' return 3 elif self.state == 'E': self.state = 'F' return 4 elif self.state == 'F': self.state = 'C' return 8 elif self.state == 'G': self.state = 'D' return 9 else: raise KeyError def main(): return Mili()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class StateMachine: state = State.A def show(self): return self.update({State.A: [State.E, 1], State.B: [State.C, 2], State.C: [State.D, 3], State.E: [State.F, 5], State.F: [State.B, 8]}) def post(self): return self.update({State.A: [State.B, 0], State.E: [State.B, 6], State.D: [State.E, 4], State.F: [State.F, 7]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class StateMachine: state = State.A def load(self): return self.update({State.F: [State.A, 9], State.E: [State.F, 6], State.B: [State.C, 2], State.A: [State.C, 1]}) def unite(self): return self.update({State.A: [State.B, 0], State.B: [State.G, 3], State.F: [State.G, 8], State.E: [State.C, 7], State.C: [State.D, 4], State.D: [State.E, 5]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class main: state = State.A def bend(self): return self.update({State.A: [State.C, 1], State.B: [State.E, 3], State.G: [State.E, 9]}) def sit(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 2], State.G: [State.H, 8], State.C: [State.D, 4], State.D: [State.E, 5], State.E: [State.F, 6], State.H: [State.D, 11]}) def merge(self): return self.update({State.F: [State.G, 7], State.G: [State.A, 10]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class StateMachine: state = State.A def punch(self): return self.update({State.A: [State.B, 0], State.C: [State.D, 3], State.B: [State.E, 2], State.D: [State.E, 4], State.F: [State.D, 8]}) def march(self): return self.update({State.B: [State.C, 1], State.D: [State.B, 5], State.G: [State.B, 9], State.E: [State.F, 6], State.F: [State.G, 7]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class MilesFSM: def __init__(self): self.state = 'A' def glare(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'C': self.state = 'D' return 3 elif self.state == 'B': self.state = 'G' return 2 elif self.state == 'F': self.state = 'G' return 9 else: raise KeyError def warp(self): if self.state == 'C': self.state = 'A' return 4 elif self.state == 'E': self.state = 'B' return 8 else: raise KeyError def order(self): if self.state == 'B': self.state = 'C' return 1 elif self.state == 'D': self.state = 'F' return 6 elif self.state == 'F': self.state = 'F' return 10 elif self.state == 'G': self.state = 'H' return 11 elif self.state == 'E': self.state = 'F' return 7 else: raise KeyError def slog(self): if self.state == 'D': self.state = 'E' return 5 else: raise KeyError def main(): obj = MilesFSM() return obj" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class StateMachine: state = State.A def start(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 1], State.C: [State.A, 4], State.D: [State.E, 5], State.E: [State.F, 6], State.F: [State.D, 8]}) def loop(self): return self.update({State.B: [State.B, 2], State.C: [State.D, 3], State.F: [State.C, 7]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main: def __init__(self): self.__state = 'A' def pan(self): if self.__state == 'A': return 1 if self.__state == 'D': self.__state = 'E' return 4 if self.__state == 'E': self.__state = 'F' return 6 if self.__state == 'F': self.__state = 'G' return 8 raise KeyError def chalk(self): if self.__state == 'A': self.__state = 'B' return 0 if self.__state == 'B': self.__state = 'C' return 2 if self.__state == 'C': self.__state = 'D' return 3 if self.__state == 'D': self.__state = 'G' return 5 if self.__state == 'E': self.__state = 'B' return 7 if self.__state == 'G': self.__state = 'E' return 9 raise KeyError" "class main: def __init__(self): self.condition = 'A' def race(self): if self.condition == 'A': self.condition = 'B' return 0 elif self.condition == 'B': self.condition = 'C' return 2 elif self.condition == 'F': self.condition = 'F' return 7 elif self.condition == 'E': self.condition = 'A' return 6 else: raise KeyError def drag(self): if self.condition == 'C': self.condition = 'D' return 3 elif self.condition == 'D': self.condition = 'E' return 4 elif self.condition == 'E': self.condition = 'F' return 5 elif self.condition == 'A': self.condition = 'F' return 1 elif self.condition == 'F': self.condition = 'B' return 8 else: raise KeyError" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def trash(self): return self.update({State.A: [State.B, 0], State.B: [State.E, 2], State.E: [State.E, 7], State.F: [State.F, 8]}) def chain(self): return self.update({State.B: [State.C, 1], State.C: [State.D, 3], State.D: [State.E, 5]}) def flip(self): return self.update({State.C: [State.A, 4], State.E: [State.F, 6]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class Mile: current_state = 'A' def pose(self): if self.current_state == 'A': return 1 elif self.current_state == 'B': self.current_state = 'C' return 2 elif self.current_state == 'C': self.current_state = 'G' return 4 elif self.current_state == 'E': self.current_state = 'B' return 7 else: raise KeyError def glare(self): if self.current_state == 'A': self.current_state = 'B' return 0 elif self.current_state == 'C': self.current_state = 'D' return 3 elif self.current_state == 'E': self.current_state = 'F' return 6 elif self.current_state == 'F': self.current_state = 'G' return 9 else: raise KeyError def group(self): if self.current_state == 'E': self.current_state = 'C' return 8 elif self.current_state == 'D': self.current_state = 'E' return 5 else: raise KeyError def main(): o = Mile() return o" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class StateMachine: state = State.A def speed(self): return self.update({State.A: [State.A, 1], State.B: [State.C, 3], State.C: [State.D, 5], State.D: [State.E, 6]}) def align(self): return self.update({State.A: [State.B, 0], State.B: [State.D, 4]}) def build(self): return self.update({State.A: [State.C, 2], State.E: [State.F, 7], State.F: [State.F, 8]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class main: state = State.A def clear(self): return self.update({State.A: [State.B, 0], State.C: [State.C, 5], State.B: [State.F, 3], State.D: [State.E, 6], State.E: [State.F, 8]}) def start(self): return self.update({State.A: [State.D, 1], State.B: [State.C, 2], State.C: [State.D, 4], State.D: [State.G, 7], State.F: [State.G, 9]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal" "class main: def __init__(self): self.condition = 'A' def blame(self): if self.condition == 'A': self.condition = 'B' return 0 elif self.condition == 'C': self.condition = 'C' return 3 elif self.condition == 'E': self.condition = 'F' return 7 else: raise KeyError def share(self): if self.condition == 'B': self.condition = 'C' return 1 elif self.condition == 'C': self.condition = 'D' return 2 elif self.condition == 'D': self.condition = 'E' return 5 elif self.condition == 'F': self.condition = 'G' return 9 else: raise KeyError def crack(self): if self.condition == 'C': self.condition = 'G' return 4 elif self.condition == 'D': self.condition = 'G' return 6 elif self.condition == 'E': self.condition = 'G' return 8 else: raise KeyError" "class StateMachine: state = 'A' def rush(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'D': self.state = 'B' return 4 elif self.state == 'C': self.state = 'D' return 2 elif self.state == 'E': self.state = 'F' return 5 elif self.state == 'F': return 8 elif self.state == 'G': self.state = 'B' return 9 else: raise KeyError def coast(self): if self.state == 'B': self.state = 'C' return 1 elif self.state == 'E': self.state = 'B' return 6 elif self.state == 'D': self.state = 'E' return 3 elif self.state == 'F': self.state = 'G' return 7 else: raise KeyError def open(self): if self.state == 'C': self.state = 'D' return 2 elif self.state == 'E': self.state = 'C' return 7 elif self.state == 'F': self.state = 'C' return 8 elif self.state == 'D': self.state = 'B' return 4 else: raise KeyError def main(): return StateMachine()" "class main: def __init__(self): self._state = 'A' self._graph = {('A', 'fade'): ('B', 0), ('B', 'fade'): ('C', 2), ('A', 'mass'): ('C', 1), ('C', 'start'): ('D', 3), ('D', 'fade'): ('D', 6), ('D', 'start'): ('E', 4), ('D', 'mass'): ('G', 5), ('E', 'start'): ('F', 7), ('F', 'fade'): ('G', 8), ('G', 'start'): ('E', 9)} def start(self): (self._state, r) = self._graph[self._state, 'start'] return r def fade(self): (self._state, r) = self._graph[self._state, 'fade'] return r def mass(self): (self._state, r) = self._graph[self._state, 'mass'] return r" "class main: point = 'A' clean1 = {'A': '0B', 'B': '3F', 'C': '5F', 'D': '6E'} cut1 = {'B': '2C', 'C': '4D', 'E': '8F', 'A': '1E', 'D': '7B'} def clean(self): tmp_blame = self.point if self.clean1.get(tmp_blame, 'KeyError')[1] != 'e': self.point = self.clean1.get(tmp_blame, 'KeyError')[1] return int(self.clean1.get(tmp_blame)[0]) else: raise KeyError def cut(self): tmp_view = self.point if self.cut1.get(tmp_view, 'KeyError')[1] != 'e': self.point = self.cut1.get(tmp_view, 'KeyError')[1] return int(self.cut1.get(tmp_view)[0]) else: raise KeyError" "class main: def __init__(self): self.name = 'A' def rev(self): if self.name == 'A': self.name = 'B' return 0 elif self.name == 'B': self.name = 'C' return 1 elif self.name == 'C': self.name = 'D' return 3 elif self.name == 'E': self.name = 'F' return 5 elif self.name == 'G': self.name = 'D' return 8 else: raise KeyError def log(self): if self.name == 'B': return 2 elif self.name == 'D': self.name = 'E' return 4 elif self.name == 'E': self.name = 'B' return 6 elif self.name == 'F': self.name = 'G' return 7 elif self.name == 'G': self.name = 'B' return 9 else: raise KeyError" "class main: currentLetter = 'A' movementClone = {'A': '0B', 'B': '2C', 'D': '4E', 'E': '5F', 'F': '8C'} movementFlip = {'A': '1G', 'C': '3D', 'F': '6G', 'G': '9C'} movementJog = {'F': '7B'} def clone(self): temp = self.currentLetter if self.movementClone.get(temp, 'KeyError')[1] != 'e': self.currentLetter = self.movementClone.get(temp, 'KeyError')[1] return int(self.movementClone.get(temp)[0]) else: raise KeyError def flip(self): temp = self.currentLetter if self.movementFlip.get(temp, 'KeyError')[1] != 'e': self.currentLetter = self.movementFlip.get(temp, 'KeyError')[1] return int(self.movementFlip.get(temp)[0]) else: raise KeyError def jog(self): temp = self.currentLetter if self.movementJog.get(temp, 'KeyError')[1] != 'e': self.currentLetter = self.movementJog.get(temp, 'KeyError')[1] return int(self.movementJog.get(temp)[0]) else: raise KeyError" "def main(): class mille: def __init__(self): self.cur_state = 'A' self.routes = {'A': ['key error', ('B', 0), 'key error'], 'B': [('E', 3), ('D', 2), ('C', 1)], 'C': ['key error', 'key error', ('D', 4)], 'D': ['key error', ('E', 5), 'key error'], 'E': ['key error', ('F', 6), 'key error'], 'F': ['key error', ('A', 7), ('B', 8)]} def cue(self): if self.routes[self.cur_state][0] != 'key error': result = self.routes[self.cur_state][0][1] self.cur_state = self.routes[self.cur_state][0][0] return result else: raise KeyError def make(self): if self.routes[self.cur_state][1] != 'key error': result = self.routes[self.cur_state][1][1] self.cur_state = self.routes[self.cur_state][1][0] return result else: raise KeyError def spin(self): if self.routes[self.cur_state][2] != 'key error': result = self.routes[self.cur_state][2][1] self.cur_state = self.routes[self.cur_state][2][0] return result else: raise KeyError return mille() o = main() o.make() o.spin() o.spin() o.make() o.make()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class StateMachine: state = State.A def merge(self): return self.update({State.A: [State.B, 0], State.B: [State.D, 2], State.C: [State.D, 4], State.E: [State.F, 6]}) def file(self): return self.update({State.B: [State.C, 1], State.D: [State.E, 5], State.F: [State.G, 8], State.G: [State.C, 9]}) def pose(self): return self.update({State.B: [State.E, 3], State.E: [State.G, 7]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def cut(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 2], State.C: [State.G, 4], State.G: [State.H, 9], State.F: [State.F, 8]}) def rig(self): return self.update({State.A: [State.E, 1], State.G: [State.G, 10], State.C: [State.D, 3]}) def skid(self): return self.update({State.H: [State.A, 11], State.D: [State.E, 5], State.E: [State.F, 6], State.F: [State.G, 7]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class FSM: state = State.A def place(self): return self.update({State.A: [State.B, 0], State.C: [State.C, 3], State.D: [State.E, 4], State.E: [State.F, 6], State.F: [State.G, 8], State.G: [State.A, 9]}) def forge(self): return self.update({State.B: [State.C, 1], State.C: [State.D, 2], State.D: [State.A, 5], State.E: [State.A, 7]}) def update(self, tr): (self.state, sg) = tr[self.state] return sg def main(): return FSM()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def look(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 1], State.C: [State.D, 2], State.D: [State.B, 4], State.E: [State.F, 6]}) def rock(self): return self.update({State.E: [State.A, 8], State.D: [State.G, 5]}) def step(self): return self.update({State.D: [State.E, 3], State.E: [State.E, 7], State.F: [State.G, 9]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class Machine(object): def __init__(self): self.cons = 'a' def type(self): if self.cons == 'a': raise KeyError() elif self.cons == 'b': return 2 elif self.cons == 'c': self.cons = 'd' return 3 elif self.cons == 'd': self.cons = 'e' return 5 elif self.cons == 'e': raise KeyError() elif self.cons == 'f': raise KeyError() elif self.cons == 'g': self.cons = 'd' return 8 def blame(self): if self.cons == 'a': self.cons = 'b' return 0 elif self.cons == 'b': self.cons = 'c' return 1 elif self.cons == 'c': self.cons = 'g' return 4 elif self.cons == 'd': raise KeyError() elif self.cons == 'e': self.cons = 'f' return 6 elif self.cons == 'f': self.cons = 'g' return 7 elif self.cons == 'g': self.cons = 'a' return 9 def main(): return Machine()" "class Mili: def __init__(self): self.current_state = 'a' def debug(self): if self.current_state == 'a': return 1 elif self.current_state == 'b': self.current_state = 'c' return 2 elif self.current_state == 'c': self.current_state = 'd' return 4 elif self.current_state == 'd': self.current_state = 'e' return 6 elif self.current_state == 'e': self.current_state = 'f' return 7 elif self.current_state == 'f': raise KeyError def mask(self): if self.current_state == 'a': self.current_state = 'b' return 0 elif self.current_state == 'b': return 3 elif self.current_state == 'c': self.current_state = 'f' return 5 elif self.current_state == 'd': raise KeyError elif self.current_state == 'e': raise KeyError elif self.current_state == 'f': self.current_state = 'd' return 8 def main(): o = Mili() return o" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def loop(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 2], State.C: [State.D, 3], State.E: [State.F, 6], State.F: [State.D, 9]}) def race(self): return self.update({State.A: [State.C, 1], State.C: [State.E, 4], State.D: [State.E, 5], State.E: [State.B, 7], State.F: [State.G, 8]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine() o = main()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def chat(self): return self.update({State.A: [State.B, 0], State.D: [State.E, 5], State.F: [State.G, 8], State.G: [State.A, 9]}) def turn(self): return self.update({State.A: [State.C, 1], State.B: [State.G, 3], State.E: [State.C, 7]}) def check(self): return self.update({State.B: [State.C, 2], State.C: [State.D, 4], State.E: [State.F, 6]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class StateMachine: state = State.A def model(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 1], State.C: [State.C, 6], State.D: [State.E, 7]}) def apply(self): return self.update({State.B: [State.B, 4], State.E: [State.F, 8]}) def slip(self): return self.update({State.B: [State.E, 2]}) def jump(self): return self.update({State.C: [State.D, 5], State.B: [State.F, 5]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class Mile: def __init__(self): self.place = 'a' def load(self): if self.place == 'a': self.place = 'b' return 0 if self.place == 'e': self.place = 'f' return 6 if self.place == 'f': self.place = 'b' return 9 else: raise KeyError def spawn(self): if self.place == 'a': self.place = 'd' return 2 if self.place == 'b': self.place = 'c' return 3 if self.place == 'd': self.place = 'e' return 5 if self.place == 'f': self.place = 'g' return 8 else: raise KeyError def close(self): if self.place == 'a': self.place = 'e' return 1 if self.place == 'c': self.place = 'd' return 4 if self.place == 'e': self.place = 'g' return 7 else: raise KeyError def main(): return Mile()" "class main: def __init__(self): self.state = 'A' def debug(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'D': self.state = 'E' return 5 else: raise KeyError def zoom(self): if self.state == 'B': self.state = 'C' return 2 elif self.state == 'F': self.state = 'G' return 7 elif self.state == 'G': self.state = 'G' return 8 elif self.state == 'C': self.state = 'F' return 4 else: raise KeyError def peek(self): if self.state == 'C': self.state = 'D' return 3 elif self.state == 'G': self.state = 'E' return 9 elif self.state == 'A': self.state = 'F' return 1 elif self.state == 'E': self.state = 'F' return 6 else: raise KeyError" "class StateMachine: state = 'A' def join(self): if self.state == 'A': self.state = 'A' return 1 elif self.state == 'C': self.state = 'D' return 5 elif self.state == 'D': self.state = 'E' return 6 elif self.state == 'E': self.state = 'F' return 7 else: raise KeyError def hoard(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'B' return 4 else: raise KeyError def align(self): if self.state == 'A': self.state = 'C' return 2 elif self.state == 'B': self.state = 'C' return 3 elif self.state == 'F': self.state = 'F' return 8 else: raise KeyError def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class StateMachine: state = State.A def brake(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 1], State.C: [State.G, 4], State.D: [State.E, 6]}) def chain(self): return self.update({State.C: [State.E, 5]}) def spin(self): return self.update({State.C: [State.D, 2], State.E: [State.F, 7], State.F: [State.G, 9]}) def order(self): return self.update({State.C: [State.C, 3], State.E: [State.E, 8]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def stare(self): return self.update({State.A: [State.B, 0], State.D: [State.H, 5], State.E: [State.H, 8], State.G: [State.C, 11]}) def build(self): return self.update({State.B: [State.C, 1], State.D: [State.E, 3]}) def etch(self): return self.update({State.C: [State.D, 2], State.D: [State.A, 6], State.E: [State.F, 7], State.F: [State.G, 9]}) def pull(self): return self.update({State.D: [State.B, 4], State.G: [State.H, 10]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class State: current_state = 20 def update(obj={}): fun_state = State.current_state State.current_state = obj[State.current_state] return obj[fun_state] class main: def scale(self): result = State.update(obj={0: 3, 6: 3}) return result def begin(self): result = State.update(obj={0: 1, 1: 4, 2: 9, 7: 9, 4: 5, 5: 8, 10: 5, 6: 1}) return result def shade(self): result = State.update(obj={20: 0, 3: 11, 9: 11, 8: 11, 5: 7, 7: 10, 2: 10}) return result def crash(self): result = State.update(obj={0: 2, 4: 6, 6: 2, 10: 6}) return result" "class main: def __init__(self): self.position = 0 self.graph = [[1, 2, 4], [9, 9, 2], [9, 9, 3], [9, 9, 4], [9, 5, 2], [9, 1, 9]] self.mark = [[0, 1, 2], [9, 9, 3], [9, 9, 4], [9, 9, 5], [9, 6, 7], [9, 8, 9]] def skew(self): if self.graph[self.position][0] == 9: raise KeyError pos = self.mark[self.position][0] self.position = self.graph[self.position][0] return pos def debug(self): if self.graph[self.position][1] == 9: raise KeyError pos = self.mark[self.position][1] self.position = self.graph[self.position][1] return pos def stop(self): if self.graph[self.position][2] == 9: raise KeyError pos = self.mark[self.position][2] self.position = self.graph[self.position][2] return pos" "class StateMachine: state = 'A' def file(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'D': self.state = 'A' return 5 elif self.state == 'G': self.state = 'D' return 8 elif self.state == 'C': self.state = 'D' return 2 else: raise KeyError def mass(self): if self.state == 'B': self.state = 'C' return 1 elif self.state == 'C': return 3 elif self.state == 'G': self.state = 'A' return 9 elif self.state == 'F': self.state = 'G' return 7 elif self.state == 'E': self.state = 'F' return 6 elif self.state == 'D': self.state = 'E' return 4 else: raise KeyError def main(): return StateMachine()" "class FSM: def __init__(self): self.state = 'A' def __setstate__(self, state): self.state = state def __getstate__(self): return self.state def model(self): if self.__getstate__() == 'A': self.__setstate__('B') return 0 elif self.__getstate__() == 'E': self.__setstate__('F') return 6 elif self.__getstate__() == 'F': return 10 else: raise KeyError('KeyError') def sway(self): if self.__getstate__() == 'B': return 2 elif self.__getstate__() == 'D': self.__setstate__('A') return 5 elif self.__getstate__() == 'E': self.__setstate__('G') return 7 else: raise KeyError('KeyError') def bend(self): if self.__getstate__() == 'B': self.__setstate__('C') return 1 elif self.__getstate__() == 'C': self.__setstate__('D') return 3 elif self.__getstate__() == 'G': self.__setstate__('H') return 11 else: raise KeyError('KeyError') def group(self): if self.__getstate__() == 'D': self.__setstate__('E') return 4 elif self.__getstate__() == 'E': return 8 elif self.__getstate__() == 'F': self.__setstate__('G') return 9 else: raise KeyError('KeyError') def main(): return FSM()" "class Mili: state = 'A' def draw(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 2 elif self.state == 'C': self.state = 'D' return 3 elif self.state == 'F': self.state = 'G' return 7 elif self.state == 'G': self.state = 'H' return 9 elif self.state == 'H': self.state = 'F' return 11 else: raise KeyError def init(self): if self.state == 'A': self.state = 'D' return 1 elif self.state == 'D': self.state = 'E' return 5 elif self.state == 'E': self.state = 'F' return 6 elif self.state == 'F': self.state = 'A' return 8 elif self.state == 'C': self.state = 'G' return 4 elif self.state == 'H': self.state = 'B' return 10 else: raise KeyError def main(): return Mili()" "class main: def __init__(self): self.word = 'A' def align(self): if self.word == 'A': self.word = 'B' return 0 elif self.word == 'C': self.word = 'D' return 5 elif self.word == 'B': self.word = 'G' return 4 elif self.word == 'E': self.word = 'F' return 7 else: raise KeyError() def cast(self): if self.word == 'B': self.word = 'C' return 3 elif self.word == 'A': self.word = 'F' return 1 elif self.word == 'E': self.word = 'G' return 8 else: raise KeyError() def walk(self): if self.word == 'A': self.word = 'G' return 2 elif self.word == 'D': self.word = 'E' return 6 elif self.word == 'F': self.word = 'G' return 9 else: raise KeyError()" "class FSM: def __init__(self): self.state = 'A' def __setstate__(self, state): self.state = state def __getstate__(self): return self.state def coast(self): if self.__getstate__() == 'A': self.__setstate__('B') return 0 elif self.__getstate__() == 'F': self.__setstate__('B') return 9 elif self.__getstate__() == 'G': self.__setstate__('H') return 11 else: raise KeyError('KeyError') def loop(self): if self.__getstate__() == 'A': self.__setstate__('C') return 1 elif self.__getstate__() == 'B': self.__setstate__('C') return 2 elif self.__getstate__() == 'D': self.__setstate__('E') return 5 elif self.__getstate__() == 'F': return 10 else: raise KeyError('KeyError') def punch(self): if self.__getstate__() == 'B': self.__setstate__('G') return 3 elif self.__getstate__() == 'C': self.__setstate__('D') return 4 elif self.__getstate__() == 'F': self.__setstate__('G') return 7 else: raise KeyError('KeyError') def hurry(self): if self.__getstate__() == 'E': self.__setstate__('F') return 6 elif self.__getstate__() == 'F': self.__setstate__('D') return 8 else: raise KeyError('KeyError') def main(): return FSM()" "class FSM: def __init__(self): self.state = 'A' def __setstate__(self, state): self.state = state def __getstate__(self): return self.state def post(self): if self.__getstate__() == 'A': self.__setstate__('B') return 0 elif self.__getstate__() == 'D': self.__setstate__('E') return 5 else: raise KeyError('KeyError') def snap(self): if self.__getstate__() == 'A': self.__setstate__('F') return 1 elif self.__getstate__() == 'B': self.__setstate__('C') return 2 elif self.__getstate__() == 'C': return 4 elif self.__getstate__() == 'D': self.__setstate__('F') return 7 elif self.__getstate__() == 'E': self.__setstate__('F') return 8 else: raise KeyError('KeyError') def pan(self): if self.__getstate__() == 'C': self.__setstate__('D') return 3 elif self.__getstate__() == 'D': return 6 else: raise KeyError('KeyError') def main(): return FSM()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def coast(self): return self.update({State.A: [State.A, 1], State.B: [State.C, 3], State.C: [State.D, 4], State.D: [State.E, 5], State.F: [State.H, 8]}) def hop(self): return self.update({State.A: [State.B, 0], State.F: [State.G, 7], State.G: [State.H, 9], State.H: [State.E, 11]}) def scale(self): return self.update({State.A: [State.G, 2], State.E: [State.F, 6], State.G: [State.D, 10]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def fill(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 2], State.C: [State.D, 3], State.D: [State.E, 4], State.E: [State.F, 5], State.F: [State.D, 8], State.G: [State.H, 9]}) def stand(self): return self.update({State.A: [State.E, 1], State.F: [State.F, 7], State.G: [State.C, 10], State.H: [State.C, 11]}) def brake(self): return self.update({State.F: [State.G, 6]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class StateMachine: state = 'A' def herd(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'F' return 3 elif self.state == 'H': self.state = 'E' return 11 elif self.state == 'F': self.state = 'G' return 8 else: raise KeyError def put(self): if self.state == 'A': self.state = 'D' return 1 elif self.state == 'B': self.state = 'C' return 2 elif self.state == 'C': self.state = 'D' return 4 elif self.state == 'D': self.state = 'E' return 6 elif self.state == 'G': self.state = 'H' return 9 else: raise KeyError def align(self): if self.state == 'G': self.state = 'A' return 10 elif self.state == 'E': self.state = 'F' return 7 else: raise KeyError def push(self): if self.state == 'C': self.state = 'A' return 5 else: raise KeyError def main(): return StateMachine()" "class A: state = 'A' def apply(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 1 elif self.state == 'C': self.state = 'D' return 2 elif self.state == 'D': self.state = 'B' return 5 elif self.state == 'E': self.state = 'A' return 7 else: raise KeyError def loop(self): if self.state == 'C': self.state = 'F' return 3 elif self.state == 'D': self.state = 'E' return 4 elif self.state == 'E': self.state = 'F' return 6 elif self.state == 'F': self.state = 'A' return 8 else: raise KeyError def main(): return A()" "class main: def __init__(self): self.state: main.State = main.A(self) def cull(self) -> int: return self.state.cull() def make(self) -> int: return self.state.make() def color(self) -> int: return self.state.color() class State: def __init__(self, parent): self.parent: main = parent def cull(self): raise KeyError def make(self): raise KeyError def color(self): raise KeyError class A(State): def cull(self): self.parent.state = main.B(self.parent) return 0 class B(State): def make(self): self.parent.state = main.C(self.parent) return 1 class C(State): def make(self): self.parent.state = main.D(self.parent) return 2 def cull(self): self.parent.state = main.A(self.parent) return 3 class D(State): def make(self): self.parent.state = main.E(self.parent) return 4 class E(State): def color(self): self.parent.state = main.F(self.parent) return 5 def cull(self): self.parent.state = main.B(self.parent) return 6 def make(self): self.parent.state = main.E(self.parent) return 7 class F(State): def color(self): self.parent.state = main.G(self.parent) return 8 class G(State): def color(self): self.parent.state = main.B(self.parent) return 9" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def swap(self): return self.update({State.A: [State.B, 0], State.D: [State.A, 5], State.F: [State.G, 7]}) def drag(self): return self.update({State.A: [State.C, 1], State.D: [State.E, 4], State.E: [State.F, 6], State.F: [State.C, 8], State.G: [State.E, 10]}) def base(self): return self.update({State.B: [State.C, 2], State.C: [State.D, 3], State.H: [State.H, 11]}) def turn(self): return self.update({State.G: [State.H, 9]}) def update(self, transitions): try: (self.state, signal) = transitions[self.state] return signal except KeyError: raise KeyError def main(): return StateMachine()" "class main: def __init__(self): self.condition = 'A' def add(self): if self.condition == 'A': self.condition = 'A' return 1 elif self.condition == 'B': self.condition = 'D' return 4 else: raise KeyError def share(self): if self.condition == 'A': self.condition = 'C' return 2 elif self.condition == 'B': self.condition = 'C' return 3 elif self.condition == 'C': self.condition = 'D' return 5 elif self.condition == 'D': self.condition = 'F' return 7 else: raise KeyError def click(self): if self.condition == 'A': self.condition = 'B' return 0 elif self.condition == 'D': self.condition = 'E' return 6 elif self.condition == 'E': self.condition = 'F' return 8 else: raise KeyError" "class main: def __init__(self): self.word = 'A' def bend(self): if self.word == 'A': self.word = 'B' return 0 elif self.word == 'B': self.word = 'B' return 3 elif self.word == 'E': self.word = 'F' return 8 else: raise KeyError() def paint(self): if self.word == 'B': self.word = 'C' return 1 elif self.word == 'C': self.word = 'D' return 5 else: raise KeyError() def slip(self): if self.word == 'C': self.word = 'F' return 6 elif self.word == 'B': self.word = 'E' return 2 else: raise KeyError() def link(self): if self.word == 'B': self.word = 'D' return 4 elif self.word == 'D': self.word = 'E' return 7 else: raise KeyError()" "class FSM: def __init__(self): self.state = 'A' def __setstate__(self, state): self.state = state def __getstate__(self): return self.state def click(self): if self.__getstate__() == 'A': self.__setstate__('B') return 0 elif self.__getstate__() == 'D': self.__setstate__('E') return 5 elif self.__getstate__() == 'F': self.__setstate__('G') return 7 elif self.__getstate__() == 'G': self.__setstate__('B') return 9 else: raise KeyError('KeyError') def play(self): if self.__getstate__() == 'B': self.__setstate__('C') return 1 elif self.__getstate__() == 'C': self.__setstate__('E') return 4 elif self.__getstate__() == 'E': self.__setstate__('F') return 6 elif self.__getstate__() == 'G': self.__setstate__('H') return 8 else: raise KeyError('KeyError') def begin(self): if self.__getstate__() == 'C': self.__setstate__('D') return 3 elif self.__getstate__() == 'B': self.__setstate__('E') return 2 elif self.__getstate__() == 'H': return 11 else: raise KeyError('KeyError') def leer(self): if self.__getstate__() == 'H': self.__setstate__('E') return 10 else: raise KeyError('KeyError') def main(): return FSM()" "class main: def __init__(self): self.state = 'A' def make(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'F' return 3 elif self.state == 'C': self.state = 'F' return 5 elif self.state == 'E': self.state = 'G' return 8 elif self.state == 'F': self.state = 'G' return 9 else: raise KeyError def merge(self): if self.state == 'B': self.state = 'C' return 2 elif self.state == 'C': self.state = 'D' return 4 elif self.state == 'D': self.state = 'E' return 6 elif self.state == 'E': self.state = 'F' return 7 elif self.state == 'A': self.state = 'F' return 1 else: raise KeyError" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class StateMachine: state = State.A def etch(self): return self.update({State.A: [State.B, 0], State.C: [State.D, 2], State.E: [State.A, 6], State.F: [State.A, 7]}) def smash(self): return self.update({State.B: [State.C, 1], State.C: [State.A, 3], State.D: [State.E, 4], State.E: [State.F, 5], State.F: [State.D, 8]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class StateMachine: state = 'A' def send(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'H' return 2 elif self.state == 'C': self.state = 'F' return 5 elif self.state == 'F': self.state = 'G' return 8 else: raise KeyError def type(self): if self.state == 'B': self.state = 'C' return 1 else: raise KeyError def get(self): if self.state == 'B': self.state = 'D' return 3 elif self.state == 'C': self.state = 'D' return 4 elif self.state == 'D': self.state = 'E' return 6 elif self.state == 'E': self.state = 'F' return 7 elif self.state == 'F': return 9 elif self.state == 'H': self.state = 'F' return 11 elif self.state == 'G': self.state = 'H' return 10 else: raise KeyError def main(): return StateMachine()" "class main: def __init__(self): self.state = 'A' def amass(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 2 elif self.state == 'C': self.state = 'C' return 4 elif self.state == 'D': self.state = 'E' return 5 elif self.state == 'E': self.state = 'F' return 7 elif self.state == 'F': self.state = 'G' return 8 else: raise KeyError def peek(self): if self.state == 'A': self.state = 'C' return 1 elif self.state == 'C': self.state = 'D' return 3 elif self.state == 'D': self.state = 'B' return 6 elif self.state == 'F': self.state = 'A' return 9 else: raise KeyError" "from abc import ABC, abstractmethod class P(ABC): @abstractmethod def pluck(self, current): pass @abstractmethod def hike(self, current): pass class A(P): def pluck(self, current): current.current = B() return 0 def hike(self, current): current.current = E() return 1 class B(P): def pluck(self, current): raise KeyError() def hike(self, current): current.current = C() return 2 class C(P): def pluck(self, current): current.current = C() return 4 def hike(self, current): current.current = D() return 3 class D(P): def pluck(self, current): raise KeyError() def hike(self, current): current.current = E() return 5 class E(P): def pluck(self, current): current.current = B() return 7 def hike(self, current): current.current = F() return 6 class F(P): def pluck(self, current): raise KeyError() def hike(self, current): current.current = G() return 8 class G(P): def pluck(self, current): current.current = G() return 9 def hike(self, current): raise KeyError() class FiniteStateMachine: def __init__(self) -> None: self.current = A() def pluck(self): return self.current.pluck(self) def hike(self): return self.current.hike(self) def main(): return FiniteStateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class StateMachine: state = State.A def loop(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 1], State.G: [State.E, 9], State.E: [State.A, 6]}) def grow(self): return self.update({State.B: [State.D, 2], State.C: [State.D, 3], State.E: [State.F, 5], State.F: [State.G, 8]}) def paste(self): return self.update({State.D: [State.E, 4], State.E: [State.E, 7]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class StateMachine: state = State.A def scrub(self): return self.update({State.A: [State.B, 0], State.C: [State.G, 4]}) def sweep(self): return self.update({State.A: [State.C, 1], State.B: [State.C, 2], State.D: [State.E, 5], State.E: [State.F, 6], State.F: [State.G, 7], State.G: [State.A, 9]}) def zoom(self): return self.update({State.C: [State.D, 3], State.G: [State.G, 8]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def hurry(self): return self.update({State.A: [State.A, 1], State.B: [State.C, 2], State.C: [State.D, 4], State.D: [State.E, 6]}) def cull(self): return self.update({State.A: [State.B, 0], State.B: [State.F, 3], State.C: [State.A, 5], State.D: [State.B, 7], State.E: [State.F, 8], State.F: [State.G, 9]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class StateMachine: state = State.A def init(self): return self.update({State.A: [State.B, 0], State.C: [State.G, 4], State.D: [State.E, 5], State.F: [State.D, 8], State.G: [State.A, 9]}) def apply(self): return self.update({State.B: [State.C, 1], State.C: [State.C, 3], State.E: [State.F, 6], State.F: [State.G, 7]}) def copy(self): return self.update({State.C: [State.D, 2]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def reset(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 1], State.D: [State.E, 3], State.F: [State.D, 8]}) def cast(self): return self.update({State.C: [State.D, 2], State.D: [State.D, 5], State.H: [State.H, 10]}) def unite(self): return self.update({State.D: [State.A, 4], State.E: [State.F, 6], State.F: [State.G, 7], State.G: [State.H, 9], State.H: [State.B, 11]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class MealyMachine(object): def __init__(self): self.state = 'A' def peek(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 2 elif self.state == 'C': self.state = 'E' return 5 elif self.state == 'D': self.state = 'E' return 6 elif self.state == 'G': self.state = 'C' return 9 else: raise KeyError def build(self): if self.state == 'A': self.state = 'D' return 1 elif self.state == 'C': self.state = 'F' return 4 else: raise KeyError def clean(self): if self.state == 'C': self.state = 'D' return 3 elif self.state == 'E': self.state = 'F' return 7 elif self.state == 'F': self.state = 'G' return 8 else: raise KeyError def main(): return MealyMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class StateMachine: state = State.A def stare(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 1], State.C: [State.D, 3], State.D: [State.E, 5]}) def loop(self): return self.update({State.B: [State.D, 2], State.D: [State.D, 7], State.E: [State.F, 8]}) def chalk(self): return self.update({State.D: [State.A, 6], State.C: [State.C, 4]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 7 class StateMachine: state = State.A def post(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 1], State.D: [State.E, 4], State.E: [State.F, 8], State.F: [State.G, 9]}) def paint(self): return self.update({State.D: [State.A, 6], State.G: [State.D, 8]}) def make(self): return self.update({State.C: [State.D, 3], State.D: [State.F, 5]}) def amass(self): return self.update({State.B: [State.F, 2], State.D: [State.G, 7]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class StateMachine: state = State.A def crack(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 1], State.C: [State.D, 3], State.D: [State.A, 6], State.F: [State.C, 8]}) def debug(self): return self.update({State.B: [State.F, 2], State.C: [State.E, 4], State.D: [State.E, 5], State.E: [State.F, 7]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main: def __init__(self): self.__state = 'A' def pan(self): if self.__state == 'A': self.__state = 'B' return 0 if self.__state == 'B': self.__state = 'E' return 3 raise KeyError def crash(self): if self.__state == 'B': self.__state = 'C' return 2 if self.__state == 'C': self.__state = 'D' return 5 if self.__state == 'E': self.__state = 'F' return 8 if self.__state == 'F': self.__state = 'G' return 9 if self.__state == 'G': self.__state = 'B' return 11 if self.__state == 'D': return 7 raise KeyError def jog(self): if self.__state == 'B': self.__state = 'D' return 4 if self.__state == 'A': self.__state = 'E' return 1 if self.__state == 'D': self.__state = 'E' return 6 if self.__state == 'G': self.__state = 'H' return 10 raise KeyError" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class StateMachine: state = State.A def run(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 1], State.C: [State.D, 3], State.D: [State.E, 5], State.E: [State.F, 6], State.F: [State.A, 8]}) def speed(self): return self.update({State.F: [State.C, 7], State.B: [State.E, 2], State.C: [State.A, 4]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class Mili: state = -1 def unite(self): if self.state in [-1, 6]: self.state = 0 elif self.state == 0: self.state = 1 elif self.state == 4: self.state = 6 elif self.state in [2, 5]: self.state = 9 else: raise KeyError return self.state def jog(self): if self.state == 0: self.state = 2 elif self.state in [1, 9]: self.state = 3 elif self.state in [8, 3]: self.state = 4 elif self.state in [2, 5]: self.state = 8 else: raise KeyError return self.state def put(self): if self.state == 4: self.state = 5 elif self.state in [2, 5]: self.state = 7 else: raise KeyError return self.state def main(): return Mili()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class StateMachine: state = State.A def pluck(self): return self.update({State.A: [State.B, 0], State.D: [State.E, 5], State.E: [State.F, 6]}) def lower(self): return self.update({State.A: [State.C, 1], State.C: [State.D, 3]}) def skew(self): return self.update({State.B: [State.C, 2], State.C: [State.C, 4], State.E: [State.B, 7], State.F: [State.D, 8]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class StateMachine: state = State.A def slip(self): return self.update({State.A: [State.B, 0], State.C: [State.D, 3], State.D: [State.E, 5]}) def shift(self): return self.update({State.B: [State.C, 1], State.C: [State.F, 4], State.D: [State.A, 6], State.E: [State.F, 8]}) def swap(self): return self.update({State.B: [State.B, 2], State.D: [State.D, 7]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main: def __init__(self): self.word = 'A' def debug(self): if self.word == 'A': self.word = 'B' return 0 elif self.word == 'B': self.word = 'E' return 2 elif self.word == 'C': self.word = 'D' return 3 elif self.word == 'F': self.word = 'G' return 7 elif self.word == 'G': self.word = 'H' return 9 else: raise KeyError() def sweep(self): if self.word == 'B': self.word = 'C' return 1 elif self.word == 'D': self.word = 'E' return 5 elif self.word == 'E': self.word = 'F' return 6 elif self.word == 'G': self.word = 'C' return 10 elif self.word == 'H': self.word = 'B' return 11 elif self.word == 'F': self.word = 'D' return 8 elif self.word == 'C': self.word = 'F' return 4 else: raise KeyError()" "class main: def __init__(self): self.state = 'A' self.graph = {('A', 'scrub'): ('B', 0), ('B', 'rig'): ('C', 1), ('B', 'start'): ('F', 2), ('B', 'scrub'): ('E', 3), ('C', 'scrub'): ('D', 4), ('C', 'rig'): ('C', 5), ('C', 'start'): ('A', 6), ('D', 'rig'): ('E', 7), ('E', 'start'): ('F', 8)} def scrub(self): (self.state, ret) = self.graph[self.state, 'scrub'] return ret def rig(self): (self.state, ret) = self.graph[self.state, 'rig'] return ret def start(self): (self.state, ret) = self.graph[self.state, 'start'] return ret" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class main: state = State.A def clone(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 3], State.F: [State.G, 8]}) def tweak(self): return self.update({State.A: [State.D, 2], State.C: [State.D, 4], State.D: [State.E, 5], State.G: [State.A, 9]}) def stare(self): return self.update({State.A: [State.F, 1], State.D: [State.B, 6], State.E: [State.F, 7]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal" "class main: def __init__(self): self.state = 'A' def slur(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'E' return 4 elif self.state == 'E': self.state = 'F' return 8 else: raise KeyError def put(self): if self.state == 'B': self.state = 'B' return 3 elif self.state == 'D': self.state = 'B' return 7 elif self.state == 'C': self.state = 'D' return 5 else: raise KeyError def clone(self): if self.state == 'B': self.state = 'C' return 2 elif self.state == 'D': self.state = 'E' return 6 elif self.state == 'A': self.state = 'F' return 1 else: raise KeyError" "class Mealy: state = 'A' def snap(self): if self.state == 'A': self.state = 'B' return 0 if self.state == 'C': self.state = 'D' return 2 if self.state == 'D': self.state = 'E' return 4 if self.state == 'E': self.state = 'F' return 6 raise KeyError def shade(self): if self.state == 'B': self.state = 'C' return 1 if self.state == 'D': self.state = 'B' return 5 if self.state == 'C': self.state = 'E' return 3 if self.state == 'E': self.state = 'B' return 7 if self.state == 'F': self.state = 'A' return 8 raise KeyError def main(): o = Mealy() return o" "class main: def __init__(self): self.condition = 'A' def hoard(self): if self.condition == 'A': self.condition = 'B' return 0 elif self.condition == 'D': self.condition = 'F' return 6 elif self.condition == 'C': self.condition = 'D' return 3 else: raise KeyError def trace(self): if self.condition == 'B': self.condition = 'C' return 1 elif self.condition == 'D': self.condition = 'E' return 4 else: raise KeyError def reset(self): if self.condition == 'D': self.condition = 'A' return 5 elif self.condition == 'E': self.condition = 'F' return 7 elif self.condition == 'F': self.condition = 'F' return 8 elif self.condition == 'B': self.condition = 'F' return 2 else: raise KeyError" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class StateMachine: state = State.A def copy(self): return self.update({State.A: [State.A, 1], State.C: [State.D, 4], State.F: [State.D, 7]}) def fork(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 3], State.D: [State.E, 5], State.F: [State.C, 8]}) def jog(self): return self.update({State.E: [State.F, 6], State.A: [State.C, 2]}) def update(self, transitions): try: (self.state, signal) = transitions[self.state] return signal except AttributeError: return 'KeyError' def main(): o = StateMachine() return o" "from abc import ABC, abstractmethod class P(ABC): @abstractmethod def stop(self, current): pass @abstractmethod def skip(self, current): pass @abstractmethod def spawn(self, current): pass class A(P): def stop(self, current): current.current = B() return 0 def skip(self, current): current.current = H() return 1 def spawn(self, current): current.current = F() return 2 class B(P): def stop(self, current): raise KeyError() def skip(self, current): current.current = C() return 3 def spawn(self, current): raise KeyError() class C(P): def stop(self, current): raise KeyError() def skip(self, current): current.current = D() return 4 def spawn(self, current): current.current = C() return 5 class D(P): def stop(self, current): current.current = F() return 7 def skip(self, current): current.current = E() return 6 def spawn(self, current): raise KeyError() class E(P): def stop(self, current): current.current = A() return 9 def skip(self, current): raise KeyError() def spawn(self, current): current.current = F() return 8 class F(P): def stop(self, current): raise KeyError() def skip(self, current): raise KeyError() def spawn(self, current): current.current = G() return 10 class G(P): def stop(self, current): raise KeyError() def skip(self, current): raise KeyError() def spawn(self, current): current.current = H() return 11 class H(P): def stop(self, current): raise KeyError() def skip(self, current): raise KeyError() def spawn(self, current): raise KeyError() class FiniteStateMachine: def __init__(self) -> None: self.current = A() def stop(self): return self.current.stop(self) def skip(self): return self.current.skip(self) def spawn(self): return self.current.spawn(self) def main(): return FiniteStateMachine()" "class StateMachine: state = 'A' def herd(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'C': self.state = 'D' return 5 elif self.state == 'D': self.state = 'E' return 6 elif self.state == 'E': self.state = 'F' return 7 else: raise KeyError def chalk(self): if self.state == 'A': self.state = 'E' return 2 elif self.state == 'B': self.state = 'C' return 3 elif self.state == 'E': self.state = 'C' return 8 else: raise KeyError def lower(self): if self.state == 'A': self.state = 'D' return 1 elif self.state == 'B': self.state = 'E' return 4 else: raise KeyError def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def fade(self): return self.update({State.A: [State.B, 0], State.C: [State.C, 3], State.D: [State.E, 4], State.E: [State.A, 8]}) def spawn(self): return self.update({State.B: [State.C, 1], State.C: [State.D, 2], State.D: [State.G, 5], State.F: [State.G, 9], State.E: [State.F, 7]}) def post(self): return self.update({State.D: [State.B, 6]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class StateMachine: state = State.A def move(self): return self.update({State.A: [State.B, 0], State.D: [State.B, 6], State.B: [State.E, 2], State.C: [State.D, 3], State.E: [State.C, 8]}) def etch(self): return self.update({State.B: [State.C, 1], State.C: [State.F, 4], State.D: [State.E, 5], State.E: [State.F, 7]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main: def __init__(self): self.condition = 'A' def grow(self): if self.condition == 'A': self.condition = 'B' return 0 elif self.condition == 'C': self.condition = 'D' return 5 elif self.condition == 'F': self.condition = 'D' return 8 elif self.condition == 'E': self.condition = 'F' return 7 else: raise KeyError def open(self): if self.condition == 'B': self.condition = 'E' return 4 elif self.condition == 'D': self.condition = 'E' return 6 elif self.condition == 'A': self.condition = 'D' return 2 else: raise KeyError def log(self): if self.condition == 'A': self.condition = 'E' return 1 elif self.condition == 'B': self.condition = 'C' return 3 else: raise KeyError" "class main(object): states = ['a', 'b', 'c', 'd', 'e', 'f', 'g'] def __init__(self): self.state = 'a' def drag(self): if self.state == 'a': self.state = 'b' return 0 if self.state == 'b': self.state = 'c' return 1 if self.state == 'c': self.state = 'd' return 3 if self.state == 'e': self.state = 'f' return 6 if self.state == 'f': self.state = 'g' return 7 if self.state == 'g': self.state = 'd' return 8 if self.state == 'd': self.state = 'e' return 5 else: raise KeyError def move(self): if self.state == 'b': self.state = 'd' return 2 if self.state == 'c': self.state = 'e' return 4 if self.state == 'g': self.state = 'a' return 9 else: raise KeyError" "class main: def __init__(self): self.state = 'A' def slog(self): if self.state == 'A': self.state = 'A' return 1 elif self.state == 'F': self.state = 'G' return 9 else: raise KeyError def rig(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'H' return 3 elif self.state == 'E': self.state = 'H' return 8 elif self.state == 'G': self.state = 'H' return 11 else: raise KeyError def hoard(self): if self.state == 'B': self.state = 'C' return 2 elif self.state == 'C': self.state = 'D' return 4 elif self.state == 'D': self.state = 'E' return 6 elif self.state == 'E': self.state = 'F' return 7 else: raise KeyError def crack(self): if self.state == 'F': self.state = 'B' return 10 elif self.state == 'C': self.state = 'H' return 5 else: raise KeyError" "class StateMachine: state = 'A' def pull(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'C': self.state = 'A' return 4 elif self.state == 'F': self.state = 'B' return 10 elif self.state == 'E': self.state = 'F' return 7 else: raise KeyError def reset(self): if self.state == 'A': self.state = 'H' return 1 elif self.state == 'B': self.state = 'C' return 2 elif self.state == 'D': self.state = 'F' return 6 elif self.state == 'F': self.state = 'G' return 9 else: raise KeyError def patch(self): if self.state == 'C': self.state = 'D' return 3 else: raise KeyError def build(self): if self.state == 'D': self.state = 'E' return 5 elif self.state == 'E': return 8 elif self.state == 'G': self.state = 'H' return 11 else: raise KeyError def main(): return StateMachine()" "class FSM: def __init__(self): self.state = 'A' def pull(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'F': self.state = 'G' return 8 else: raise KeyError def visit(self): if self.state == 'A': self.state = 'A' return 3 elif self.state == 'D': self.state = 'E' return 6 elif self.state == 'G': self.state = 'C' return 9 else: raise KeyError def glare(self): if self.state == 'B': self.state = 'C' return 4 elif self.state == 'E': self.state = 'F' return 7 elif self.state == 'A': self.state = 'F' return 2 else: raise KeyError def bend(self): if self.state == 'A': self.state = 'D' return 1 elif self.state == 'C': self.state = 'D' return 5 else: raise KeyError def main(): obj = FSM() return obj" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class StateMachine: state = State.A def clean(self): return self.update({State.A: [State.B, 0], State.B: [State.B, 3], State.C: [State.D, 4], State.D: [State.A, 7], State.E: [State.F, 8]}) def fill(self): return self.update({State.A: [State.C, 1], State.B: [State.C, 2], State.D: [State.F, 6]}) def mask(self): return self.update({State.D: [State.E, 5]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class Task9: states = {'A': (('B', 0), ('A', 1)), 'B': (('H', 3), ('C', 2)), 'C': (('E', 5), ('D', 4)), 'D': (('E', 6), None), 'E': (None, ('F', 7)), 'F': (('C', 9), ('G', 8)), 'G': (('C', 11), ('H', 10)), 'H': (None, None)} def __init__(self): self.state = 'A' def trim(self): way = self.states[self.state][0] if way is not None: self.state = way[0] return way[1] else: raise KeyError def forge(self): way = self.states[self.state][1] if way is not None: self.state = way[0] return way[1] else: raise KeyError def main(): return Task9()" "class main: def __init__(self): self.condition = 'A' def zoom(self): if self.condition == 'A': self.condition = 'B' return 0 elif self.condition == 'C': self.condition = 'D' return 4 elif self.condition == 'D': self.condition = 'E' return 6 else: raise KeyError def tread(self): if self.condition == 'B': self.condition = 'C' return 1 elif self.condition == 'C': self.condition = 'H' return 5 else: raise KeyError def flip(self): if self.condition == 'B': self.condition = 'E' return 3 elif self.condition == 'G': self.condition = 'H' return 9 elif self.condition == 'H': self.condition = 'F' return 11 else: raise KeyError def throw(self): if self.condition == 'B': self.condition = 'F' return 2 elif self.condition == 'E': self.condition = 'F' return 7 elif self.condition == 'F': self.condition = 'G' return 8 elif self.condition == 'G': self.condition = 'D' return 10 else: raise KeyError" "class Machine: state = 'A' def copy(self): if self.state == 'A': return 1 elif self.state == 'F': return 9 else: raise KeyError def carve(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'E': self.state = 'F' return 5 elif self.state == 'F': self.state = 'G' return 7 else: raise KeyError def lower(self): if self.state == 'B': self.state = 'C' return 2 elif self.state == 'C': self.state = 'D' return 3 elif self.state == 'D': self.state = 'E' return 4 elif self.state == 'E': self.state = 'C' return 6 elif self.state == 'F': self.state = 'C' return 8 else: raise KeyError def main(): return Machine()" "class Mili: def __init__(self): self.state = 'A' def edit(self): if self.state == 'A': return 2 elif self.state == 'B': self.state = 'C' return 3 elif self.state == 'C': self.state = 'D' return 4 elif self.state == 'D': self.state = 'B' return 6 elif self.state == 'E': self.state = 'F' return 7 elif self.state == 'F': self.state = 'G' return 10 elif self.state == 'G': self.state = 'H' return 11 else: raise KeyError() def shift(self): if self.state == 'A': self.state = 'G' return 1 elif self.state == 'D': self.state = 'E' return 5 elif self.state == 'E': self.state = 'G' return 8 else: raise KeyError() def chain(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'E': self.state = 'A' return 9 else: raise KeyError() def main(): o = Mili() return o" "class main: sos = 'A' def __init__(self): self.sos = 'A' def march(self): if self.sos == 'A': return 2 elif self.sos == 'D': self.sos = 'E' return 5 elif self.sos == 'C': self.sos = 'D' return 4 elif self.sos == 'E': self.sos = 'F' return 7 else: raise KeyError() def order(self): if self.sos == 'A': self.sos = 'B' return 0 elif self.sos == 'E': self.sos = 'C' return 8 elif self.sos == 'D': self.sos = 'G' return 6 else: raise KeyError() def mass(self): if self.sos == 'B': self.sos = 'C' return 3 elif self.sos == 'A': self.sos = 'D' return 1 elif self.sos == 'F': self.sos = 'G' return 9 else: raise KeyError()" "class main: def __init__(self): self.state = 'A' def chalk(self): if self.state == 'A': self.state = 'A' return 1 elif self.state == 'B': self.state = 'C' return 2 elif self.state == 'D': self.state = 'E' return 6 else: raise KeyError def model(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'F' return 4 elif self.state == 'D': self.state = 'A' return 7 else: raise KeyError def bolt(self): if self.state == 'C': self.state = 'D' return 5 elif self.state == 'E': self.state = 'F' return 8 elif self.state == 'B': self.state = 'D' return 3 else: raise KeyError" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 class StateMachine: state = State.A def walk(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 2], State.D: [State.E, 5], State.E: [State.F, 8]}) def cue(self): return self.update({State.C: [State.D, 4], State.D: [State.F, 6], State.B: [State.F, 3]}) def skip(self): return self.update({State.A: [State.E, 1], State.D: [State.D, 7]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def code(self): return self.update({State.A: [State.B, 0], State.D: [State.G, 5], State.E: [State.A, 8], State.H: [State.B, 11]}) def dash(self): return self.update({State.A: [State.H, 1], State.B: [State.C, 2], State.C: [State.D, 3], State.E: [State.F, 6]}) def pose(self): return self.update({State.D: [State.E, 4], State.E: [State.H, 7], State.F: [State.G, 9], State.G: [State.H, 10]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class Mili: def __init__(self): self.i = -1 def daub(self): if self.i == 7 or self.i == 2 or self.i == 0: self.i = 3 return 3 elif self.i == 5: self.i = 6 return 6 elif self.i == 6 or self.i == 9: self.i = 9 return 9 elif self.i == -1: self.i = 0 return 0 else: raise KeyError def mix(self): if self.i == 1: self.i = 4 return 4 elif self.i == 2 or self.i == 0 or self.i == 7: self.i = 2 return 2 elif self.i == 5: self.i = 7 return 7 else: raise KeyError def brake(self): if self.i == 0 or self.i == 2 or self.i == 7: self.i = 1 return 1 elif self.i == 4: self.i = 5 return 5 elif self.i == 6 or self.i == 9: self.i = 8 return 8 else: raise KeyError def main(): mili = Mili() return mili" "class main: def __init__(self): self.condition = 'A' def exit(self): if self.condition == 'A': self.condition = 'B' return 0 elif self.condition == 'C': self.condition = 'E' return 4 elif self.condition == 'D': self.condition = 'E' return 5 elif self.condition == 'E': self.condition = 'F' return 7 else: raise KeyError def push(self): if self.condition == 'B': self.condition = 'C' return 2 elif self.condition == 'C': self.condition = 'D' return 3 elif self.condition == 'D': self.condition = 'F' return 6 elif self.condition == 'F': self.condition = 'A' return 8 elif self.condition == 'A': self.condition = 'D' return 1 else: raise KeyError" "class StateMachine: state = 'A' def base(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 1 elif self.state == 'F': self.state = 'B' return 7 elif self.state == 'G': self.state = 'C' return 10 elif self.state == 'C': self.state = 'H' return 3 elif self.state == 'D': self.state = 'E' return 4 else: raise KeyError def punch(self): if self.state == 'C': self.state = 'D' return 2 elif self.state == 'E': self.state = 'F' return 5 elif self.state == 'F': self.state = 'G' return 6 elif self.state == 'G': self.state = 'H' return 9 else: raise KeyError def carve(self): if self.state == 'G': self.state = 'B' return 11 elif self.state == 'F': return 8 else: raise KeyError def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class StateMachine: state = State.A def base(self): return self.update({State.A: [State.B, 0], State.C: [State.D, 2], State.D: [State.E, 4], State.F: [State.G, 7]}) def slip(self): return self.update({State.B: [State.C, 1], State.C: [State.E, 3], State.D: [State.B, 5], State.E: [State.F, 6], State.F: [State.C, 8], State.G: [State.C, 9]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class main: state = State.A def mask(self): return self.update({State.A: [State.A, 2], State.C: [State.D, 4], State.E: [State.F, 6]}) def clone(self): return self.update({State.A: [State.B, 0], State.E: [State.E, 7]}) def group(self): return self.update({State.B: [State.C, 3], State.A: [State.D, 1], State.D: [State.E, 5], State.E: [State.B, 8]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal" "class main: def __init__(self): self.condition = 'A' def get(self): if self.condition == 'A': self.condition = 'B' return 0 elif self.condition == 'D': self.condition = 'F' return 6 else: raise KeyError def loop(self): if self.condition == 'B': self.condition = 'B' return 2 elif self.condition == 'C': self.condition = 'D' return 3 elif self.condition == 'D': self.condition = 'E' return 4 elif self.condition == 'E': self.condition = 'F' return 8 elif self.condition == 'F': self.condition = 'G' return 9 else: raise KeyError def fade(self): if self.condition == 'D': self.condition = 'A' return 7 else: raise KeyError def tread(self): if self.condition == 'B': self.condition = 'C' return 1 elif self.condition == 'D': self.condition = 'B' return 5 else: raise KeyError" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class StateMachine: state = State.A def visit(self): return self.update({State.A: [State.B, 0], State.C: [State.F, 5], State.E: [State.F, 8], State.F: [State.G, 9]}) def daub(self): return self.update({State.A: [State.C, 1], State.B: [State.C, 2], State.C: [State.E, 6], State.D: [State.E, 7]}) def unite(self): return self.update({State.B: [State.D, 3], State.C: [State.D, 4]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def hoard(self): return self.update({State.A: [State.B, 0], State.B: [State.C, 1], State.C: [State.D, 4], State.F: [State.G, 9]}) def split(self): return self.update({State.B: [State.B, 2], State.C: [State.E, 5], State.D: [State.E, 6], State.E: [State.F, 8], State.F: [State.H, 10], State.G: [State.H, 11]}) def cull(self): return self.update({State.B: [State.D, 3], State.D: [State.D, 7]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class StateMachine: state = State.A def bend(self): return self.update({State.A: [State.B, 0], State.B: [State.B, 4], State.E: [State.F, 7]}) def cut(self): return self.update({State.A: [State.C, 1], State.C: [State.D, 5], State.D: [State.E, 6], State.G: [State.B, 9]}) def shade(self): return self.update({State.A: [State.F, 2], State.B: [State.C, 3], State.F: [State.G, 8]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main: def __init__(self): self.state = 'A' self.graph = {('A', 'align'): ('B', 0), ('B', 'align'): ('C', 1), ('C', 'open'): ('D', 2), ('D', 'open'): ('E', 3), ('D', 'bolt'): ('G', 4), ('E', 'bolt'): ('F', 5), ('F', 'align'): ('D', 7), ('F', 'open'): ('G', 6), ('F', 'bolt'): ('A', 8), ('G', 'open'): ('G', 9)} def align(self): (self.state, ret) = self.graph[self.state, 'align'] return ret def open(self): (self.state, ret) = self.graph[self.state, 'open'] return ret def bolt(self): (self.state, ret) = self.graph[self.state, 'bolt'] return ret" "class Machine: state = 'A' def fade(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 3 elif self.state == 'D': self.state = 'E' return 6 elif self.state == 'E': self.state = 'F' return 7 elif self.state == 'F': self.state = 'G' return 8 else: raise KeyError def share(self): if self.state == 'A': self.state = 'D' return 1 elif self.state == 'F': self.state = 'A' return 9 else: raise KeyError def drive(self): if self.state == 'A': return 2 elif self.state == 'B': self.state = 'E' return 4 elif self.state == 'C': self.state = 'D' return 5 else: raise KeyError def main(): return Machine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class StateMachine: state = State.A def open(self): return self.update({State.A: [State.B, 0], State.C: [State.A, 3], State.E: [State.E, 7], State.G: [State.A, 9]}) def mute(self): return self.update({State.C: [State.F, 4], State.B: [State.C, 1], State.D: [State.E, 5]}) def amass(self): return self.update({State.C: [State.D, 2], State.E: [State.F, 6], State.F: [State.G, 8]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class main: state = State.A def shift(self): return self.update({State.A: [State.B, 0], State.C: [State.D, 4]}) def drag(self): return self.update({State.A: [State.C, 1], State.B: [State.C, 3], State.C: [State.E, 5], State.D: [State.F, 7]}) def blame(self): return self.update({State.A: [State.G, 2], State.F: [State.G, 9], State.E: [State.F, 8], State.D: [State.E, 6]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal" "class Machine: def __init__(self): self.status = 'A' def play(self): if self.status == 'A': self.status = 'B' return 0 if self.status == 'D': self.status = 'F' return 4 if self.status == 'F': self.status = 'F' return 9 else: raise KeyError def dash(self): if self.status == 'B': self.status = 'C' return 1 if self.status == 'D': self.status = 'E' return 3 if self.status == 'E': self.status = 'F' return 5 if self.status == 'F': self.status = 'C' return 8 else: raise KeyError def blame(self): if self.status == 'C': self.status = 'D' return 2 if self.status == 'F': self.status = 'A' return 7 else: raise KeyError def loop(self): if self.status == 'F': self.status = 'G' return 6 else: raise KeyError def main(): return Machine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class StateMachine: state = State.A def crack(self): return self.update({State.A: [State.A, 1], State.B: [State.B, 3], State.C: [State.H, 6]}) def crawl(self): return self.update({State.A: [State.B, 0], State.B: [State.D, 4], State.C: [State.D, 5], State.D: [State.E, 7], State.F: [State.G, 9], State.G: [State.A, 11]}) def crush(self): return self.update({State.B: [State.C, 2], State.E: [State.F, 8], State.G: [State.H, 10]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "class main: def __init__(self): self.__state = 'A' def stay(self): if self.__state == 'A': self.__state = 'B' return 0 if self.__state == 'D': self.__state = 'E' return 3 if self.__state == 'E': self.__state = 'G' return 7 raise KeyError def leer(self): if self.__state == 'B': self.__state = 'C' return 1 if self.__state == 'E': self.__state = 'F' return 4 if self.__state == 'F': self.__state = 'G' return 8 raise KeyError def send(self): if self.__state == 'E': self.__state = 'A' return 5 raise KeyError def rush(self): if self.__state == 'C': self.__state = 'D' return 2 if self.__state == 'E': return 6 if self.__state == 'G': return 9 raise KeyError" "class main: def __init__(self): self._state = 'A' self._graph = {('A', 'rock'): ('B', 0), ('A', 'code'): ('E', 1), ('B', 'code'): ('C', 2), ('C', 'code'): ('D', 3), ('C', 'apply'): ('A', 4), ('D', 'apply'): ('E', 5), ('E', 'code'): ('F', 6), ('E', 'apply'): ('C', 7), ('E', 'rock'): ('G', 8), ('F', 'rock'): ('G', 9), ('G', 'rock'): ('H', 10), ('H', 'apply'): ('C', 11)} def rock(self): (self._state, ret) = self._graph[self._state, 'rock'] return ret def code(self): (self._state, ret) = self._graph[self._state, 'code'] return ret def apply(self): (self._state, ret) = self._graph[self._state, 'apply'] return ret" "class main: def __init__(self): self.name = 'A' def patch(self): if self.name == 'A': self.name = 'B' return 0 elif self.name == 'B': self.name = 'C' return 1 elif self.name == 'C': self.name = 'D' return 4 elif self.name == 'E': self.name = 'F' return 7 else: raise KeyError def wreck(self): if self.name == 'B': return 2 elif self.name == 'D': self.name = 'E' return 5 elif self.name == 'F': return 8 else: raise KeyError def jog(self): if self.name == 'B': self.name = 'D' return 3 elif self.name == 'D': return 6 else: raise KeyError" "class Machine: state = 'A' def get(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 2 elif self.state == 'D': self.state = 'E' return 4 elif self.state == 'E': self.state = 'F' return 6 else: raise KeyError def open(self): if self.state == 'A': self.state = 'E' return 1 elif self.state == 'C': self.state = 'D' return 3 elif self.state == 'E': self.state = 'B' return 8 else: raise KeyError def sweep(self): if self.state == 'D': self.state = 'F' return 5 elif self.state == 'E': self.state = 'C' return 7 else: raise KeyError def main(): return Machine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 H = 7 class main: state = State.A def push(self): return self.update({State.A: [State.B, 0], State.E: [State.A, 5], State.C: [State.D, 2], State.F: [State.B, 8], State.H: [State.F, 10], State.D: [State.E, 3]}) def hurry(self): return self.update({State.B: [State.C, 1], State.G: [State.H, 9], State.F: [State.G, 7], State.E: [State.F, 4]}) def skew(self): return self.update({State.E: [State.G, 6], State.H: [State.H, 11]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal" "class main: def __init__(self): self.name = 'A' def melt(self): if self.name == 'A': self.name = 'B' return 0 elif self.name == 'C': self.name = 'D' return 3 elif self.name == 'E': self.name = 'F' return 6 elif self.name == 'F': self.name = 'G' return 7 elif self.name == 'G': self.name = 'B' return 9 else: raise KeyError def bend(self): if self.name == 'A': self.name = 'G' return 1 elif self.name == 'D': self.name = 'E' return 5 else: raise KeyError def zoom(self): if self.name == 'B': self.name = 'C' return 2 elif self.name == 'C': self.name = 'G' return 4 elif self.name == 'G': self.name = 'E' return 8 else: raise KeyError" "class Mili: def __init__(self): self.state = 'A' def skew(self): if self.state == 'A': self.state = 'B' return 0 if self.state == 'B': self.state = 'F' return 2 if self.state == 'E': self.state = 'F' return 8 if self.state == 'D': self.state = 'D' return 7 if self.state == 'G': self.state = 'C' return 11 if self.state == 'C': self.state = 'A' return 5 raise KeyError def copy(self): if self.state == 'B': self.state = 'C' return 1 if self.state == 'C': self.state = 'D' return 4 if self.state == 'D': self.state = 'E' return 6 if self.state == 'G': self.state = 'H' return 10 raise KeyError def close(self): if self.state == 'B': self.state = 'E' return 3 if self.state == 'F': self.state = 'G' return 9 raise KeyError def main(): o = Mili() return o" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class StateMachine: state = State.A def cue(self): return self.update({State.A: [State.B, 0], State.D: [State.E, 3], State.E: [State.E, 5]}) def place(self): return self.update({State.B: [State.C, 1], State.E: [State.B, 7], State.F: [State.F, 9]}) def rush(self): return self.update({State.C: [State.D, 2], State.E: [State.C, 6], State.F: [State.G, 8]}) def hoard(self): return self.update({State.E: [State.F, 4]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal def main(): return StateMachine()" "from enum import Enum class State(Enum): A = 0 B = 1 C = 2 D = 3 E = 4 F = 5 G = 6 class main: state = State.A def glare(self): return self.update({State.A: [State.B, 0], State.C: [State.D, 4], State.E: [State.F, 7], State.F: [State.G, 8]}) def snap(self): return self.update({State.A: [State.G, 1], State.C: [State.G, 5]}) def place(self): return self.update({State.B: [State.C, 3], State.A: [State.D, 2], State.D: [State.E, 6], State.F: [State.A, 9]}) def update(self, transitions): (self.state, signal) = transitions[self.state] return signal" "class StateMachine: state = 'A' def reset(self): if self.state == 'A': self.state = 'B' return 0 elif self.state == 'B': self.state = 'C' return 2 elif self.state == 'G': self.state = 'C' return 10 else: raise KeyError def peek(self): if self.state == 'A': self.state = 'F' return 1 elif self.state == 'F': self.state = 'G' return 8 elif self.state == 'G': self.state = 'H' return 9 elif self.state == 'B': return 3 elif self.state == 'C': self.state = 'D' return 5 elif self.state == 'E': self.state = 'F' return 7 else: raise KeyError def crush(self): if self.state == 'B': self.state = 'D' return 4 elif self.state == 'D': self.state = 'E' return 6 elif self.state == 'H': self.state = 'E' return 11 else: raise KeyError def main(): return StateMachine()" "class A: def init(self, state): state.state = B() return 0 def bend(self, state): raise KeyError() class B: def bend(self, state): state.state = C() return 1 def init(self, state): state.state = G() return 2 class C: def bend(self, state): state.state = D() return 3 def init(self, state): raise KeyError() class D: def init(self, state): state.state = E() return 4 def bend(self, state): raise KeyError() class E: def init(self, state): state.state = E() return 6 def bend(self, state): state.state = F() return 5 class F: def bend(self, state): state.state = G() return 7 def init(self, state): raise KeyError() class G: def init(self, state): state.state = H() return 8 def bend(self, state): state.state = A() return 9 class H: def init(self, state): state.state = H() return 11 def bend(self, state): state.state = C() return 10 class StateMachine: def __init__(self) -> None: self.state = A() def init(self) -> int: return self.state.init(self) def bend(self) -> int: return self.state.bend(self) def main(): return StateMachine()"