def __init__(self): Automaton.__init__(self, VERBOSE) # Define States self.INIT = 0 self.SCAN_COPY_XML = 1 self.INSERT_PAUSES = 2 self.TALLY_PASS = 3 self.PRIMARY_ANALYSIS = 4 self.WRITE_RESULTS = 5 # Initial Transition self.Transition(self.INIT)
def __init__(self): Automaton.__init__(self, VERBOSE) # Define States self.INIT = 0 self.GET_BATCH_CFG = 1 self.DESIGN_SEQ = 2 self.DESIGN_PAUSE = 3 self.PERF_ANALYSIS = 4 self.LOG_RESULTS = 5 self.COMPLETE = 6 # Initial Transition self.Transition(self.INIT)
def make_random_automaton(n: Int) -> Automaton: """ builds an n states x k inputs automation with a random transition table :param n: :return: Automation """ seed = (next(rand_num)) table = [[(next(rand_num)) for _ in range(n)] for _ in range(n)] return Automaton(seed, 0.0, table, seed)
def make_random_automaton(n): """ builds an n states x k inputs automation with a random transition table :param n: :return: Automation """ seed = random.randrange(n) table = [] for i in range(0, n): trans = random.sample(xrange(n), n) table = table + [trans] return Automaton(seed, 0, table, seed)
def grim_trigger(p0): return Automaton(COOPERATE, p0, t4, COOPERATE)
def tit_for_tat(p0): return Automaton(COOPERATE, p0, t3, COOPERATE)
def cooperates(p0): return Automaton(COOPERATE, p0, t2, COOPERATE)
def defects(p0): return Automaton(DEFECT, p0, t1, DEFECT)