broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(phase, events, seed):
    payload = list(range(seed, seed * 2 + 2))
    r = {'local_enabled': phase=='speaking', 'remote_enabled': phase in ('listening','offered'), 'offered': phase=='offered', 'queue': payload[:], 'received': [], 'burst': []}
    frames = []
    observed = []
    table = {('listening', 'turn_offer'): ('offered', 'ack_offer'), ('offered', 'turn_commit'): ('offered', 'wait'), ('speaking', 'yield'): ('yielding', 'send_yield'), ('yielding', 'yield_ack'): ('listening', 'disable_transmit'), ('listening', 'remote_payload'): ('listening', 'deliver'), ('speaking', 'remote_payload'): ('speaking', 'report_collision'), ('listening', 'local_payload'): ('listening', 'queue_local'), ('offered', 'offer_withdrawn'): ('listening', 'clear_offer'), ('yielding', 'local_payload'): ('yielding', 'queue_next_turn'), ('listening', 'unsolicited_commit'): ('listening', 'reject_unoffered')}
    for event in events:
        phase, action = table.get((phase, event), (phase, "reject"))
        if action == 'ack_offer':
            frames.append(['TURN_READY',seed])
        elif action == 'enable_transmit':
            r['local_enabled']=True; r['remote_enabled']=False
        elif action == 'send_yield':
            frames.append(['YIELD',seed]); r['local_enabled']=False
        elif action == 'disable_transmit':
            r['local_enabled']=False; r['remote_enabled']=True
        elif action == 'deliver':
            r['received'].extend(payload)
        elif action == 'report_collision':
            frames.append(['COLLISION',seed])
        elif action == 'queue_local':
            r['queue'].extend(payload)
        elif action == 'clear_offer':
            r['offered']=False
        elif action == 'queue_next_turn':
            r['queue'].extend(payload)
        elif action == 'reject_unoffered':
            frames.append(['NO_TURN_OFFER',seed])
        elif action == 'send_payload':
            r['burst'].extend(payload)
        elif action == 'enable_both':
            r['local_enabled']=True; r['remote_enabled']=True
        elif action == 'disable_now':
            r['local_enabled']=False
        elif action == 'keep_admitting':
            r['queue'].extend(payload)
        elif action == 'take_turn':
            r['local_enabled']=True
        elif action == 'echo':
            frames.append(['DATA',payload])
        elif action == 'drop_local':
            r['queue']=[]
        elif action == 'append_current_burst':
            r['burst'].extend(payload)
        else:
            if action not in ("wait", "ignore", "keep", "retain", "keep_peer", "keep_offer", "keep_hold", "keep_batch", "retain_staging", "keep_staging", "keep_local_owner", "keep_old_session", "keep_address", "keep_old_expiry", "ignore_conflict", "keep_service", "keep_subscription", "retain_shadow", "keep_live", "keep_suspicion", "keep_roles", "keep_staged"):
                frames.append([action, payload[:]])
        observed.append(json.loads(json.dumps({"phase": phase, "registers": r, "frames": frames})))
    return observed
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [('listening/turn_offer', 'listening', ['turn_offer'], [{'phase': 'offered', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [1, 2, 3], 'received': [], 'burst': []}, 'frames': [['TURN_READY', 1]]}]), ('offered/turn_commit', 'offered', ['turn_commit'], [{'phase': 'speaking', 'registers': {'local_enabled': True, 'remote_enabled': False, 'offered': True, 'queue': [1, 2, 3], 'received': [], 'burst': []}, 'frames': []}]), ('speaking/yield', 'speaking', ['yield'], [{'phase': 'yielding', 'registers': {'local_enabled': False, 'remote_enabled': False, 'offered': False, 'queue': [1, 2, 3], 'received': [], 'burst': []}, 'frames': [['YIELD', 1]]}]), ('yielding/yield_ack', 'yielding', ['yield_ack'], [{'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [1, 2, 3], 'received': [], 'burst': []}, 'frames': []}]), ('listening/remote_payload', 'listening', ['remote_payload'], [{'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [1, 2, 3], 'received': [1, 2, 3], 'burst': []}, 'frames': []}]), ('speaking/remote_payload', 'speaking', ['remote_payload'], [{'phase': 'speaking', 'registers': {'local_enabled': True, 'remote_enabled': False, 'offered': False, 'queue': [1, 2, 3], 'received': [], 'burst': []}, 'frames': [['COLLISION', 1]]}]), ('listening/local_payload', 'listening', ['local_payload'], [{'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [1, 2, 3, 1, 2, 3], 'received': [], 'burst': []}, 'frames': []}]), ('offered/offer_withdrawn', 'offered', ['offer_withdrawn'], [{'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [1, 2, 3], 'received': [], 'burst': []}, 'frames': []}]), ('yielding/local_payload', 'yielding', ['local_payload'], [{'phase': 'yielding', 'registers': {'local_enabled': False, 'remote_enabled': False, 'offered': False, 'queue': [1, 2, 3, 1, 2, 3], 'received': [], 'burst': []}, 'frames': []}]), ('listening/unsolicited_commit', 'listening', ['unsolicited_commit'], [{'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [1, 2, 3], 'received': [], 'burst': []}, 'frames': [['NO_TURN_OFFER', 1]]}]), ('ordered trace 0', 'listening', ['turn_offer', 'offer_withdrawn', 'local_payload', 'unsolicited_commit'], [{'phase': 'offered', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [1, 2, 3], 'received': [], 'burst': []}, 'frames': [['TURN_READY', 1]]}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [1, 2, 3], 'received': [], 'burst': []}, 'frames': [['TURN_READY', 1]]}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [1, 2, 3, 1, 2, 3], 'received': [], 'burst': []}, 'frames': [['TURN_READY', 1]]}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [1, 2, 3, 1, 2, 3], 'received': [], 'burst': []}, 'frames': [['TURN_READY', 1], ['NO_TURN_OFFER', 1]]}]), ('ordered trace 3', 'yielding', ['local_payload', 'yield_ack', 'remote_payload', 'local_payload'], [{'phase': 'yielding', 'registers': {'local_enabled': False, 'remote_enabled': False, 'offered': False, 'queue': [1, 2, 3, 1, 2, 3], 'received': [], 'burst': []}, 'frames': []}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [1, 2, 3, 1, 2, 3], 'received': [], 'burst': []}, 'frames': []}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [1, 2, 3, 1, 2, 3], 'received': [1, 2, 3], 'burst': []}, 'frames': []}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [1, 2, 3, 1, 2, 3, 1, 2, 3], 'received': [1, 2, 3], 'burst': []}, 'frames': []}]), ('empty input', 'listening', [], []), ('unknown event', 'listening', ['unsupported'], [{'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [1, 2, 3], 'received': [], 'burst': []}, 'frames': [['reject', [1, 2, 3]]]}])], 2: [('listening/turn_offer', 'listening', ['turn_offer'], [{'phase': 'offered', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [2, 3, 4, 5], 'received': [], 'burst': []}, 'frames': [['TURN_READY', 2]]}]), ('offered/turn_commit', 'offered', ['turn_commit'], [{'phase': 'speaking', 'registers': {'local_enabled': True, 'remote_enabled': False, 'offered': True, 'queue': [2, 3, 4, 5], 'received': [], 'burst': []}, 'frames': []}]), ('speaking/yield', 'speaking', ['yield'], [{'phase': 'yielding', 'registers': {'local_enabled': False, 'remote_enabled': False, 'offered': False, 'queue': [2, 3, 4, 5], 'received': [], 'burst': []}, 'frames': [['YIELD', 2]]}]), ('yielding/yield_ack', 'yielding', ['yield_ack'], [{'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [2, 3, 4, 5], 'received': [], 'burst': []}, 'frames': []}]), ('listening/remote_payload', 'listening', ['remote_payload'], [{'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [2, 3, 4, 5], 'received': [2, 3, 4, 5], 'burst': []}, 'frames': []}]), ('speaking/remote_payload', 'speaking', ['remote_payload'], [{'phase': 'speaking', 'registers': {'local_enabled': True, 'remote_enabled': False, 'offered': False, 'queue': [2, 3, 4, 5], 'received': [], 'burst': []}, 'frames': [['COLLISION', 2]]}]), ('listening/local_payload', 'listening', ['local_payload'], [{'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [2, 3, 4, 5, 2, 3, 4, 5], 'received': [], 'burst': []}, 'frames': []}]), ('offered/offer_withdrawn', 'offered', ['offer_withdrawn'], [{'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [2, 3, 4, 5], 'received': [], 'burst': []}, 'frames': []}]), ('yielding/local_payload', 'yielding', ['local_payload'], [{'phase': 'yielding', 'registers': {'local_enabled': False, 'remote_enabled': False, 'offered': False, 'queue': [2, 3, 4, 5, 2, 3, 4, 5], 'received': [], 'burst': []}, 'frames': []}]), ('listening/unsolicited_commit', 'listening', ['unsolicited_commit'], [{'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [2, 3, 4, 5], 'received': [], 'burst': []}, 'frames': [['NO_TURN_OFFER', 2]]}]), ('ordered trace 0', 'listening', ['turn_offer', 'offer_withdrawn', 'local_payload', 'unsolicited_commit', 'turn_offer'], [{'phase': 'offered', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [2, 3, 4, 5], 'received': [], 'burst': []}, 'frames': [['TURN_READY', 2]]}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [2, 3, 4, 5], 'received': [], 'burst': []}, 'frames': [['TURN_READY', 2]]}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [2, 3, 4, 5, 2, 3, 4, 5], 'received': [], 'burst': []}, 'frames': [['TURN_READY', 2]]}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [2, 3, 4, 5, 2, 3, 4, 5], 'received': [], 'burst': []}, 'frames': [['TURN_READY', 2], ['NO_TURN_OFFER', 2]]}, {'phase': 'offered', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [2, 3, 4, 5, 2, 3, 4, 5], 'received': [], 'burst': []}, 'frames': [['TURN_READY', 2], ['NO_TURN_OFFER', 2], ['TURN_READY', 2]]}]), ('ordered trace 3', 'yielding', ['local_payload', 'yield_ack', 'remote_payload', 'local_payload', 'unsolicited_commit'], [{'phase': 'yielding', 'registers': {'local_enabled': False, 'remote_enabled': False, 'offered': False, 'queue': [2, 3, 4, 5, 2, 3, 4, 5], 'received': [], 'burst': []}, 'frames': []}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [2, 3, 4, 5, 2, 3, 4, 5], 'received': [], 'burst': []}, 'frames': []}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [2, 3, 4, 5, 2, 3, 4, 5], 'received': [2, 3, 4, 5], 'burst': []}, 'frames': []}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [2, 3, 4, 5, 2, 3, 4, 5, 2, 3, 4, 5], 'received': [2, 3, 4, 5], 'burst': []}, 'frames': []}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [2, 3, 4, 5, 2, 3, 4, 5, 2, 3, 4, 5], 'received': [2, 3, 4, 5], 'burst': []}, 'frames': [['NO_TURN_OFFER', 2]]}]), ('empty input', 'listening', [], []), ('unknown event', 'listening', ['unsupported'], [{'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [2, 3, 4, 5], 'received': [], 'burst': []}, 'frames': [['reject', [2, 3, 4, 5]]]}])], 3: [('listening/turn_offer', 'listening', ['turn_offer'], [{'phase': 'offered', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [3, 4, 5, 6, 7], 'received': [], 'burst': []}, 'frames': [['TURN_READY', 3]]}]), ('offered/turn_commit', 'offered', ['turn_commit'], [{'phase': 'speaking', 'registers': {'local_enabled': True, 'remote_enabled': False, 'offered': True, 'queue': [3, 4, 5, 6, 7], 'received': [], 'burst': []}, 'frames': []}]), ('speaking/yield', 'speaking', ['yield'], [{'phase': 'yielding', 'registers': {'local_enabled': False, 'remote_enabled': False, 'offered': False, 'queue': [3, 4, 5, 6, 7], 'received': [], 'burst': []}, 'frames': [['YIELD', 3]]}]), ('yielding/yield_ack', 'yielding', ['yield_ack'], [{'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [3, 4, 5, 6, 7], 'received': [], 'burst': []}, 'frames': []}]), ('listening/remote_payload', 'listening', ['remote_payload'], [{'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [3, 4, 5, 6, 7], 'received': [3, 4, 5, 6, 7], 'burst': []}, 'frames': []}]), ('speaking/remote_payload', 'speaking', ['remote_payload'], [{'phase': 'speaking', 'registers': {'local_enabled': True, 'remote_enabled': False, 'offered': False, 'queue': [3, 4, 5, 6, 7], 'received': [], 'burst': []}, 'frames': [['COLLISION', 3]]}]), ('listening/local_payload', 'listening', ['local_payload'], [{'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [3, 4, 5, 6, 7, 3, 4, 5, 6, 7], 'received': [], 'burst': []}, 'frames': []}]), ('offered/offer_withdrawn', 'offered', ['offer_withdrawn'], [{'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [3, 4, 5, 6, 7], 'received': [], 'burst': []}, 'frames': []}]), ('yielding/local_payload', 'yielding', ['local_payload'], [{'phase': 'yielding', 'registers': {'local_enabled': False, 'remote_enabled': False, 'offered': False, 'queue': [3, 4, 5, 6, 7, 3, 4, 5, 6, 7], 'received': [], 'burst': []}, 'frames': []}]), ('listening/unsolicited_commit', 'listening', ['unsolicited_commit'], [{'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [3, 4, 5, 6, 7], 'received': [], 'burst': []}, 'frames': [['NO_TURN_OFFER', 3]]}]), ('ordered trace 0', 'listening', ['turn_offer', 'offer_withdrawn', 'local_payload', 'unsolicited_commit', 'turn_offer', 'offer_withdrawn'], [{'phase': 'offered', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [3, 4, 5, 6, 7], 'received': [], 'burst': []}, 'frames': [['TURN_READY', 3]]}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [3, 4, 5, 6, 7], 'received': [], 'burst': []}, 'frames': [['TURN_READY', 3]]}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [3, 4, 5, 6, 7, 3, 4, 5, 6, 7], 'received': [], 'burst': []}, 'frames': [['TURN_READY', 3]]}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [3, 4, 5, 6, 7, 3, 4, 5, 6, 7], 'received': [], 'burst': []}, 'frames': [['TURN_READY', 3], ['NO_TURN_OFFER', 3]]}, {'phase': 'offered', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [3, 4, 5, 6, 7, 3, 4, 5, 6, 7], 'received': [], 'burst': []}, 'frames': [['TURN_READY', 3], ['NO_TURN_OFFER', 3], ['TURN_READY', 3]]}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [3, 4, 5, 6, 7, 3, 4, 5, 6, 7], 'received': [], 'burst': []}, 'frames': [['TURN_READY', 3], ['NO_TURN_OFFER', 3], ['TURN_READY', 3]]}]), ('ordered trace 3', 'yielding', ['local_payload', 'yield_ack', 'remote_payload', 'local_payload', 'unsolicited_commit', 'turn_offer'], [{'phase': 'yielding', 'registers': {'local_enabled': False, 'remote_enabled': False, 'offered': False, 'queue': [3, 4, 5, 6, 7, 3, 4, 5, 6, 7], 'received': [], 'burst': []}, 'frames': []}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [3, 4, 5, 6, 7, 3, 4, 5, 6, 7], 'received': [], 'burst': []}, 'frames': []}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [3, 4, 5, 6, 7, 3, 4, 5, 6, 7], 'received': [3, 4, 5, 6, 7], 'burst': []}, 'frames': []}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [3, 4, 5, 6, 7, 3, 4, 5, 6, 7, 3, 4, 5, 6, 7], 'received': [3, 4, 5, 6, 7], 'burst': []}, 'frames': []}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [3, 4, 5, 6, 7, 3, 4, 5, 6, 7, 3, 4, 5, 6, 7], 'received': [3, 4, 5, 6, 7], 'burst': []}, 'frames': [['NO_TURN_OFFER', 3]]}, {'phase': 'offered', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [3, 4, 5, 6, 7, 3, 4, 5, 6, 7, 3, 4, 5, 6, 7], 'received': [3, 4, 5, 6, 7], 'burst': []}, 'frames': [['NO_TURN_OFFER', 3], ['TURN_READY', 3]]}]), ('empty input', 'listening', [], []), ('unknown event', 'listening', ['unsupported'], [{'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [3, 4, 5, 6, 7], 'received': [], 'burst': []}, 'frames': [['reject', [3, 4, 5, 6, 7]]]}])], 4: [('listening/turn_offer', 'listening', ['turn_offer'], [{'phase': 'offered', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [4, 5, 6, 7, 8, 9], 'received': [], 'burst': []}, 'frames': [['TURN_READY', 4]]}]), ('offered/turn_commit', 'offered', ['turn_commit'], [{'phase': 'speaking', 'registers': {'local_enabled': True, 'remote_enabled': False, 'offered': True, 'queue': [4, 5, 6, 7, 8, 9], 'received': [], 'burst': []}, 'frames': []}]), ('speaking/yield', 'speaking', ['yield'], [{'phase': 'yielding', 'registers': {'local_enabled': False, 'remote_enabled': False, 'offered': False, 'queue': [4, 5, 6, 7, 8, 9], 'received': [], 'burst': []}, 'frames': [['YIELD', 4]]}]), ('yielding/yield_ack', 'yielding', ['yield_ack'], [{'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [4, 5, 6, 7, 8, 9], 'received': [], 'burst': []}, 'frames': []}]), ('listening/remote_payload', 'listening', ['remote_payload'], [{'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [4, 5, 6, 7, 8, 9], 'received': [4, 5, 6, 7, 8, 9], 'burst': []}, 'frames': []}]), ('speaking/remote_payload', 'speaking', ['remote_payload'], [{'phase': 'speaking', 'registers': {'local_enabled': True, 'remote_enabled': False, 'offered': False, 'queue': [4, 5, 6, 7, 8, 9], 'received': [], 'burst': []}, 'frames': [['COLLISION', 4]]}]), ('listening/local_payload', 'listening', ['local_payload'], [{'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [4, 5, 6, 7, 8, 9, 4, 5, 6, 7, 8, 9], 'received': [], 'burst': []}, 'frames': []}]), ('offered/offer_withdrawn', 'offered', ['offer_withdrawn'], [{'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [4, 5, 6, 7, 8, 9], 'received': [], 'burst': []}, 'frames': []}]), ('yielding/local_payload', 'yielding', ['local_payload'], [{'phase': 'yielding', 'registers': {'local_enabled': False, 'remote_enabled': False, 'offered': False, 'queue': [4, 5, 6, 7, 8, 9, 4, 5, 6, 7, 8, 9], 'received': [], 'burst': []}, 'frames': []}]), ('listening/unsolicited_commit', 'listening', ['unsolicited_commit'], [{'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [4, 5, 6, 7, 8, 9], 'received': [], 'burst': []}, 'frames': [['NO_TURN_OFFER', 4]]}]), ('ordered trace 0', 'listening', ['turn_offer', 'offer_withdrawn', 'local_payload', 'unsolicited_commit', 'turn_offer', 'offer_withdrawn', 'local_payload'], [{'phase': 'offered', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [4, 5, 6, 7, 8, 9], 'received': [], 'burst': []}, 'frames': [['TURN_READY', 4]]}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [4, 5, 6, 7, 8, 9], 'received': [], 'burst': []}, 'frames': [['TURN_READY', 4]]}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [4, 5, 6, 7, 8, 9, 4, 5, 6, 7, 8, 9], 'received': [], 'burst': []}, 'frames': [['TURN_READY', 4]]}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [4, 5, 6, 7, 8, 9, 4, 5, 6, 7, 8, 9], 'received': [], 'burst': []}, 'frames': [['TURN_READY', 4], ['NO_TURN_OFFER', 4]]}, {'phase': 'offered', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [4, 5, 6, 7, 8, 9, 4, 5, 6, 7, 8, 9], 'received': [], 'burst': []}, 'frames': [['TURN_READY', 4], ['NO_TURN_OFFER', 4], ['TURN_READY', 4]]}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [4, 5, 6, 7, 8, 9, 4, 5, 6, 7, 8, 9], 'received': [], 'burst': []}, 'frames': [['TURN_READY', 4], ['NO_TURN_OFFER', 4], ['TURN_READY', 4]]}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [4, 5, 6, 7, 8, 9, 4, 5, 6, 7, 8, 9, 4, 5, 6, 7, 8, 9], 'received': [], 'burst': []}, 'frames': [['TURN_READY', 4], ['NO_TURN_OFFER', 4], ['TURN_READY', 4]]}]), ('ordered trace 3', 'yielding', ['local_payload', 'yield_ack', 'remote_payload', 'local_payload', 'unsolicited_commit', 'turn_offer', 'offer_withdrawn'], [{'phase': 'yielding', 'registers': {'local_enabled': False, 'remote_enabled': False, 'offered': False, 'queue': [4, 5, 6, 7, 8, 9, 4, 5, 6, 7, 8, 9], 'received': [], 'burst': []}, 'frames': []}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [4, 5, 6, 7, 8, 9, 4, 5, 6, 7, 8, 9], 'received': [], 'burst': []}, 'frames': []}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [4, 5, 6, 7, 8, 9, 4, 5, 6, 7, 8, 9], 'received': [4, 5, 6, 7, 8, 9], 'burst': []}, 'frames': []}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [4, 5, 6, 7, 8, 9, 4, 5, 6, 7, 8, 9, 4, 5, 6, 7, 8, 9], 'received': [4, 5, 6, 7, 8, 9], 'burst': []}, 'frames': []}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [4, 5, 6, 7, 8, 9, 4, 5, 6, 7, 8, 9, 4, 5, 6, 7, 8, 9], 'received': [4, 5, 6, 7, 8, 9], 'burst': []}, 'frames': [['NO_TURN_OFFER', 4]]}, {'phase': 'offered', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [4, 5, 6, 7, 8, 9, 4, 5, 6, 7, 8, 9, 4, 5, 6, 7, 8, 9], 'received': [4, 5, 6, 7, 8, 9], 'burst': []}, 'frames': [['NO_TURN_OFFER', 4], ['TURN_READY', 4]]}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [4, 5, 6, 7, 8, 9, 4, 5, 6, 7, 8, 9, 4, 5, 6, 7, 8, 9], 'received': [4, 5, 6, 7, 8, 9], 'burst': []}, 'frames': [['NO_TURN_OFFER', 4], ['TURN_READY', 4]]}]), ('empty input', 'listening', [], []), ('unknown event', 'listening', ['unsupported'], [{'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [4, 5, 6, 7, 8, 9], 'received': [], 'burst': []}, 'frames': [['reject', [4, 5, 6, 7, 8, 9]]]}])], 5: [('listening/turn_offer', 'listening', ['turn_offer'], [{'phase': 'offered', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [5, 6, 7, 8, 9, 10, 11], 'received': [], 'burst': []}, 'frames': [['TURN_READY', 5]]}]), ('offered/turn_commit', 'offered', ['turn_commit'], [{'phase': 'speaking', 'registers': {'local_enabled': True, 'remote_enabled': False, 'offered': True, 'queue': [5, 6, 7, 8, 9, 10, 11], 'received': [], 'burst': []}, 'frames': []}]), ('speaking/yield', 'speaking', ['yield'], [{'phase': 'yielding', 'registers': {'local_enabled': False, 'remote_enabled': False, 'offered': False, 'queue': [5, 6, 7, 8, 9, 10, 11], 'received': [], 'burst': []}, 'frames': [['YIELD', 5]]}]), ('yielding/yield_ack', 'yielding', ['yield_ack'], [{'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [5, 6, 7, 8, 9, 10, 11], 'received': [], 'burst': []}, 'frames': []}]), ('listening/remote_payload', 'listening', ['remote_payload'], [{'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [5, 6, 7, 8, 9, 10, 11], 'received': [5, 6, 7, 8, 9, 10, 11], 'burst': []}, 'frames': []}]), ('speaking/remote_payload', 'speaking', ['remote_payload'], [{'phase': 'speaking', 'registers': {'local_enabled': True, 'remote_enabled': False, 'offered': False, 'queue': [5, 6, 7, 8, 9, 10, 11], 'received': [], 'burst': []}, 'frames': [['COLLISION', 5]]}]), ('listening/local_payload', 'listening', ['local_payload'], [{'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11], 'received': [], 'burst': []}, 'frames': []}]), ('offered/offer_withdrawn', 'offered', ['offer_withdrawn'], [{'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [5, 6, 7, 8, 9, 10, 11], 'received': [], 'burst': []}, 'frames': []}]), ('yielding/local_payload', 'yielding', ['local_payload'], [{'phase': 'yielding', 'registers': {'local_enabled': False, 'remote_enabled': False, 'offered': False, 'queue': [5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11], 'received': [], 'burst': []}, 'frames': []}]), ('listening/unsolicited_commit', 'listening', ['unsolicited_commit'], [{'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [5, 6, 7, 8, 9, 10, 11], 'received': [], 'burst': []}, 'frames': [['NO_TURN_OFFER', 5]]}]), ('ordered trace 0', 'listening', ['turn_offer', 'offer_withdrawn', 'local_payload', 'unsolicited_commit', 'turn_offer', 'offer_withdrawn', 'local_payload', 'unsolicited_commit'], [{'phase': 'offered', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [5, 6, 7, 8, 9, 10, 11], 'received': [], 'burst': []}, 'frames': [['TURN_READY', 5]]}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [5, 6, 7, 8, 9, 10, 11], 'received': [], 'burst': []}, 'frames': [['TURN_READY', 5]]}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11], 'received': [], 'burst': []}, 'frames': [['TURN_READY', 5]]}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11], 'received': [], 'burst': []}, 'frames': [['TURN_READY', 5], ['NO_TURN_OFFER', 5]]}, {'phase': 'offered', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11], 'received': [], 'burst': []}, 'frames': [['TURN_READY', 5], ['NO_TURN_OFFER', 5], ['TURN_READY', 5]]}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11], 'received': [], 'burst': []}, 'frames': [['TURN_READY', 5], ['NO_TURN_OFFER', 5], ['TURN_READY', 5]]}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11], 'received': [], 'burst': []}, 'frames': [['TURN_READY', 5], ['NO_TURN_OFFER', 5], ['TURN_READY', 5]]}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11], 'received': [], 'burst': []}, 'frames': [['TURN_READY', 5], ['NO_TURN_OFFER', 5], ['TURN_READY', 5], ['NO_TURN_OFFER', 5]]}]), ('ordered trace 3', 'yielding', ['local_payload', 'yield_ack', 'remote_payload', 'local_payload', 'unsolicited_commit', 'turn_offer', 'offer_withdrawn', 'local_payload'], [{'phase': 'yielding', 'registers': {'local_enabled': False, 'remote_enabled': False, 'offered': False, 'queue': [5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11], 'received': [], 'burst': []}, 'frames': []}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11], 'received': [], 'burst': []}, 'frames': []}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11], 'received': [5, 6, 7, 8, 9, 10, 11], 'burst': []}, 'frames': []}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11], 'received': [5, 6, 7, 8, 9, 10, 11], 'burst': []}, 'frames': []}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11], 'received': [5, 6, 7, 8, 9, 10, 11], 'burst': []}, 'frames': [['NO_TURN_OFFER', 5]]}, {'phase': 'offered', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11], 'received': [5, 6, 7, 8, 9, 10, 11], 'burst': []}, 'frames': [['NO_TURN_OFFER', 5], ['TURN_READY', 5]]}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11], 'received': [5, 6, 7, 8, 9, 10, 11], 'burst': []}, 'frames': [['NO_TURN_OFFER', 5], ['TURN_READY', 5]]}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11], 'received': [5, 6, 7, 8, 9, 10, 11], 'burst': []}, 'frames': [['NO_TURN_OFFER', 5], ['TURN_READY', 5]]}]), ('empty input', 'listening', [], []), ('unknown event', 'listening', ['unsupported'], [{'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [5, 6, 7, 8, 9, 10, 11], 'received': [], 'burst': []}, 'frames': [['reject', [5, 6, 7, 8, 9, 10, 11]]]}])]}
for label, phase, events, expected in cases[N]:
    check(label, solve(phase, events, N), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

meaning: Fixture-count band, not measured model difficulty

deps: stdlib

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(phase, events, seed):
    payload = list(range(seed, seed * 2 + 2))
    r = {'local_enabled': phase=='speaking', 'remote_enabled': phase in ('listening','offered'), 'offered': phase=='offered', 'queue': payload[:], 'received': [], 'burst': []}
    frames = []
    observed = []
    table = {('listening', 'turn_offer'): ('offered', 'ack_offer'), ('offered', 'turn_commit'): ('speaking', 'enable_both'), ('speaking', 'yield'): ('yielding', 'send_yield'), ('yielding', 'yield_ack'): ('listening', 'disable_transmit'), ('listening', 'remote_payload'): ('listening', 'deliver'), ('speaking', 'remote_payload'): ('speaking', 'report_collision'), ('listening', 'local_payload'): ('listening', 'queue_local'), ('offered', 'offer_withdrawn'): ('listening', 'clear_offer'), ('yielding', 'local_payload'): ('yielding', 'queue_next_turn'), ('listening', 'unsolicited_commit'): ('listening', 'reject_unoffered')}
    for event in events:
        phase, action = table.get((phase, event), (phase, "reject"))
        if action == 'ack_offer':
            frames.append(['TURN_READY',seed])
        elif action == 'enable_transmit':
            r['local_enabled']=True; r['remote_enabled']=False
        elif action == 'send_yield':
            frames.append(['YIELD',seed]); r['local_enabled']=False
        elif action == 'disable_transmit':
            r['local_enabled']=False; r['remote_enabled']=True
        elif action == 'deliver':
            r['received'].extend(payload)
        elif action == 'report_collision':
            frames.append(['COLLISION',seed])
        elif action == 'queue_local':
            r['queue'].extend(payload)
        elif action == 'clear_offer':
            r['offered']=False
        elif action == 'queue_next_turn':
            r['queue'].extend(payload)
        elif action == 'reject_unoffered':
            frames.append(['NO_TURN_OFFER',seed])
        elif action == 'send_payload':
            r['burst'].extend(payload)
        elif action == 'enable_both':
            r['local_enabled']=True; r['remote_enabled']=True
        elif action == 'disable_now':
            r['local_enabled']=False
        elif action == 'keep_admitting':
            r['queue'].extend(payload)
        elif action == 'take_turn':
            r['local_enabled']=True
        elif action == 'echo':
            frames.append(['DATA',payload])
        elif action == 'drop_local':
            r['queue']=[]
        elif action == 'append_current_burst':
            r['burst'].extend(payload)
        else:
            if action not in ("wait", "ignore", "keep", "retain", "keep_peer", "keep_offer", "keep_hold", "keep_batch", "retain_staging", "keep_staging", "keep_local_owner", "keep_old_session", "keep_address", "keep_old_expiry", "ignore_conflict", "keep_service", "keep_subscription", "retain_shadow", "keep_live", "keep_suspicion", "keep_roles", "keep_staged"):
                frames.append([action, payload[:]])
        observed.append(json.loads(json.dumps({"phase": phase, "registers": r, "frames": frames})))
    return observed
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [('listening/turn_offer', 'listening', ['turn_offer'], [{'phase': 'offered', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [1, 2, 3], 'received': [], 'burst': []}, 'frames': [['TURN_READY', 1]]}]), ('offered/turn_commit', 'offered', ['turn_commit'], [{'phase': 'speaking', 'registers': {'local_enabled': True, 'remote_enabled': False, 'offered': True, 'queue': [1, 2, 3], 'received': [], 'burst': []}, 'frames': []}]), ('speaking/yield', 'speaking', ['yield'], [{'phase': 'yielding', 'registers': {'local_enabled': False, 'remote_enabled': False, 'offered': False, 'queue': [1, 2, 3], 'received': [], 'burst': []}, 'frames': [['YIELD', 1]]}]), ('yielding/yield_ack', 'yielding', ['yield_ack'], [{'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [1, 2, 3], 'received': [], 'burst': []}, 'frames': []}]), ('listening/remote_payload', 'listening', ['remote_payload'], [{'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [1, 2, 3], 'received': [1, 2, 3], 'burst': []}, 'frames': []}]), ('speaking/remote_payload', 'speaking', ['remote_payload'], [{'phase': 'speaking', 'registers': {'local_enabled': True, 'remote_enabled': False, 'offered': False, 'queue': [1, 2, 3], 'received': [], 'burst': []}, 'frames': [['COLLISION', 1]]}]), ('listening/local_payload', 'listening', ['local_payload'], [{'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [1, 2, 3, 1, 2, 3], 'received': [], 'burst': []}, 'frames': []}]), ('offered/offer_withdrawn', 'offered', ['offer_withdrawn'], [{'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [1, 2, 3], 'received': [], 'burst': []}, 'frames': []}]), ('yielding/local_payload', 'yielding', ['local_payload'], [{'phase': 'yielding', 'registers': {'local_enabled': False, 'remote_enabled': False, 'offered': False, 'queue': [1, 2, 3, 1, 2, 3], 'received': [], 'burst': []}, 'frames': []}]), ('listening/unsolicited_commit', 'listening', ['unsolicited_commit'], [{'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [1, 2, 3], 'received': [], 'burst': []}, 'frames': [['NO_TURN_OFFER', 1]]}]), ('ordered trace 0', 'listening', ['turn_offer', 'offer_withdrawn', 'local_payload', 'unsolicited_commit'], [{'phase': 'offered', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [1, 2, 3], 'received': [], 'burst': []}, 'frames': [['TURN_READY', 1]]}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [1, 2, 3], 'received': [], 'burst': []}, 'frames': [['TURN_READY', 1]]}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [1, 2, 3, 1, 2, 3], 'received': [], 'burst': []}, 'frames': [['TURN_READY', 1]]}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [1, 2, 3, 1, 2, 3], 'received': [], 'burst': []}, 'frames': [['TURN_READY', 1], ['NO_TURN_OFFER', 1]]}]), ('ordered trace 3', 'yielding', ['local_payload', 'yield_ack', 'remote_payload', 'local_payload'], [{'phase': 'yielding', 'registers': {'local_enabled': False, 'remote_enabled': False, 'offered': False, 'queue': [1, 2, 3, 1, 2, 3], 'received': [], 'burst': []}, 'frames': []}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [1, 2, 3, 1, 2, 3], 'received': [], 'burst': []}, 'frames': []}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [1, 2, 3, 1, 2, 3], 'received': [1, 2, 3], 'burst': []}, 'frames': []}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [1, 2, 3, 1, 2, 3, 1, 2, 3], 'received': [1, 2, 3], 'burst': []}, 'frames': []}]), ('empty input', 'listening', [], []), ('unknown event', 'listening', ['unsupported'], [{'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [1, 2, 3], 'received': [], 'burst': []}, 'frames': [['reject', [1, 2, 3]]]}])], 2: [('listening/turn_offer', 'listening', ['turn_offer'], [{'phase': 'offered', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [2, 3, 4, 5], 'received': [], 'burst': []}, 'frames': [['TURN_READY', 2]]}]), ('offered/turn_commit', 'offered', ['turn_commit'], [{'phase': 'speaking', 'registers': {'local_enabled': True, 'remote_enabled': False, 'offered': True, 'queue': [2, 3, 4, 5], 'received': [], 'burst': []}, 'frames': []}]), ('speaking/yield', 'speaking', ['yield'], [{'phase': 'yielding', 'registers': {'local_enabled': False, 'remote_enabled': False, 'offered': False, 'queue': [2, 3, 4, 5], 'received': [], 'burst': []}, 'frames': [['YIELD', 2]]}]), ('yielding/yield_ack', 'yielding', ['yield_ack'], [{'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [2, 3, 4, 5], 'received': [], 'burst': []}, 'frames': []}]), ('listening/remote_payload', 'listening', ['remote_payload'], [{'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [2, 3, 4, 5], 'received': [2, 3, 4, 5], 'burst': []}, 'frames': []}]), ('speaking/remote_payload', 'speaking', ['remote_payload'], [{'phase': 'speaking', 'registers': {'local_enabled': True, 'remote_enabled': False, 'offered': False, 'queue': [2, 3, 4, 5], 'received': [], 'burst': []}, 'frames': [['COLLISION', 2]]}]), ('listening/local_payload', 'listening', ['local_payload'], [{'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [2, 3, 4, 5, 2, 3, 4, 5], 'received': [], 'burst': []}, 'frames': []}]), ('offered/offer_withdrawn', 'offered', ['offer_withdrawn'], [{'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [2, 3, 4, 5], 'received': [], 'burst': []}, 'frames': []}]), ('yielding/local_payload', 'yielding', ['local_payload'], [{'phase': 'yielding', 'registers': {'local_enabled': False, 'remote_enabled': False, 'offered': False, 'queue': [2, 3, 4, 5, 2, 3, 4, 5], 'received': [], 'burst': []}, 'frames': []}]), ('listening/unsolicited_commit', 'listening', ['unsolicited_commit'], [{'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [2, 3, 4, 5], 'received': [], 'burst': []}, 'frames': [['NO_TURN_OFFER', 2]]}]), ('ordered trace 0', 'listening', ['turn_offer', 'offer_withdrawn', 'local_payload', 'unsolicited_commit', 'turn_offer'], [{'phase': 'offered', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [2, 3, 4, 5], 'received': [], 'burst': []}, 'frames': [['TURN_READY', 2]]}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [2, 3, 4, 5], 'received': [], 'burst': []}, 'frames': [['TURN_READY', 2]]}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [2, 3, 4, 5, 2, 3, 4, 5], 'received': [], 'burst': []}, 'frames': [['TURN_READY', 2]]}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [2, 3, 4, 5, 2, 3, 4, 5], 'received': [], 'burst': []}, 'frames': [['TURN_READY', 2], ['NO_TURN_OFFER', 2]]}, {'phase': 'offered', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [2, 3, 4, 5, 2, 3, 4, 5], 'received': [], 'burst': []}, 'frames': [['TURN_READY', 2], ['NO_TURN_OFFER', 2], ['TURN_READY', 2]]}]), ('ordered trace 3', 'yielding', ['local_payload', 'yield_ack', 'remote_payload', 'local_payload', 'unsolicited_commit'], [{'phase': 'yielding', 'registers': {'local_enabled': False, 'remote_enabled': False, 'offered': False, 'queue': [2, 3, 4, 5, 2, 3, 4, 5], 'received': [], 'burst': []}, 'frames': []}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [2, 3, 4, 5, 2, 3, 4, 5], 'received': [], 'burst': []}, 'frames': []}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [2, 3, 4, 5, 2, 3, 4, 5], 'received': [2, 3, 4, 5], 'burst': []}, 'frames': []}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [2, 3, 4, 5, 2, 3, 4, 5, 2, 3, 4, 5], 'received': [2, 3, 4, 5], 'burst': []}, 'frames': []}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [2, 3, 4, 5, 2, 3, 4, 5, 2, 3, 4, 5], 'received': [2, 3, 4, 5], 'burst': []}, 'frames': [['NO_TURN_OFFER', 2]]}]), ('empty input', 'listening', [], []), ('unknown event', 'listening', ['unsupported'], [{'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [2, 3, 4, 5], 'received': [], 'burst': []}, 'frames': [['reject', [2, 3, 4, 5]]]}])], 3: [('listening/turn_offer', 'listening', ['turn_offer'], [{'phase': 'offered', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [3, 4, 5, 6, 7], 'received': [], 'burst': []}, 'frames': [['TURN_READY', 3]]}]), ('offered/turn_commit', 'offered', ['turn_commit'], [{'phase': 'speaking', 'registers': {'local_enabled': True, 'remote_enabled': False, 'offered': True, 'queue': [3, 4, 5, 6, 7], 'received': [], 'burst': []}, 'frames': []}]), ('speaking/yield', 'speaking', ['yield'], [{'phase': 'yielding', 'registers': {'local_enabled': False, 'remote_enabled': False, 'offered': False, 'queue': [3, 4, 5, 6, 7], 'received': [], 'burst': []}, 'frames': [['YIELD', 3]]}]), ('yielding/yield_ack', 'yielding', ['yield_ack'], [{'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [3, 4, 5, 6, 7], 'received': [], 'burst': []}, 'frames': []}]), ('listening/remote_payload', 'listening', ['remote_payload'], [{'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [3, 4, 5, 6, 7], 'received': [3, 4, 5, 6, 7], 'burst': []}, 'frames': []}]), ('speaking/remote_payload', 'speaking', ['remote_payload'], [{'phase': 'speaking', 'registers': {'local_enabled': True, 'remote_enabled': False, 'offered': False, 'queue': [3, 4, 5, 6, 7], 'received': [], 'burst': []}, 'frames': [['COLLISION', 3]]}]), ('listening/local_payload', 'listening', ['local_payload'], [{'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [3, 4, 5, 6, 7, 3, 4, 5, 6, 7], 'received': [], 'burst': []}, 'frames': []}]), ('offered/offer_withdrawn', 'offered', ['offer_withdrawn'], [{'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [3, 4, 5, 6, 7], 'received': [], 'burst': []}, 'frames': []}]), ('yielding/local_payload', 'yielding', ['local_payload'], [{'phase': 'yielding', 'registers': {'local_enabled': False, 'remote_enabled': False, 'offered': False, 'queue': [3, 4, 5, 6, 7, 3, 4, 5, 6, 7], 'received': [], 'burst': []}, 'frames': []}]), ('listening/unsolicited_commit', 'listening', ['unsolicited_commit'], [{'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [3, 4, 5, 6, 7], 'received': [], 'burst': []}, 'frames': [['NO_TURN_OFFER', 3]]}]), ('ordered trace 0', 'listening', ['turn_offer', 'offer_withdrawn', 'local_payload', 'unsolicited_commit', 'turn_offer', 'offer_withdrawn'], [{'phase': 'offered', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [3, 4, 5, 6, 7], 'received': [], 'burst': []}, 'frames': [['TURN_READY', 3]]}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [3, 4, 5, 6, 7], 'received': [], 'burst': []}, 'frames': [['TURN_READY', 3]]}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [3, 4, 5, 6, 7, 3, 4, 5, 6, 7], 'received': [], 'burst': []}, 'frames': [['TURN_READY', 3]]}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [3, 4, 5, 6, 7, 3, 4, 5, 6, 7], 'received': [], 'burst': []}, 'frames': [['TURN_READY', 3], ['NO_TURN_OFFER', 3]]}, {'phase': 'offered', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [3, 4, 5, 6, 7, 3, 4, 5, 6, 7], 'received': [], 'burst': []}, 'frames': [['TURN_READY', 3], ['NO_TURN_OFFER', 3], ['TURN_READY', 3]]}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [3, 4, 5, 6, 7, 3, 4, 5, 6, 7], 'received': [], 'burst': []}, 'frames': [['TURN_READY', 3], ['NO_TURN_OFFER', 3], ['TURN_READY', 3]]}]), ('ordered trace 3', 'yielding', ['local_payload', 'yield_ack', 'remote_payload', 'local_payload', 'unsolicited_commit', 'turn_offer'], [{'phase': 'yielding', 'registers': {'local_enabled': False, 'remote_enabled': False, 'offered': False, 'queue': [3, 4, 5, 6, 7, 3, 4, 5, 6, 7], 'received': [], 'burst': []}, 'frames': []}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [3, 4, 5, 6, 7, 3, 4, 5, 6, 7], 'received': [], 'burst': []}, 'frames': []}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [3, 4, 5, 6, 7, 3, 4, 5, 6, 7], 'received': [3, 4, 5, 6, 7], 'burst': []}, 'frames': []}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [3, 4, 5, 6, 7, 3, 4, 5, 6, 7, 3, 4, 5, 6, 7], 'received': [3, 4, 5, 6, 7], 'burst': []}, 'frames': []}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [3, 4, 5, 6, 7, 3, 4, 5, 6, 7, 3, 4, 5, 6, 7], 'received': [3, 4, 5, 6, 7], 'burst': []}, 'frames': [['NO_TURN_OFFER', 3]]}, {'phase': 'offered', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [3, 4, 5, 6, 7, 3, 4, 5, 6, 7, 3, 4, 5, 6, 7], 'received': [3, 4, 5, 6, 7], 'burst': []}, 'frames': [['NO_TURN_OFFER', 3], ['TURN_READY', 3]]}]), ('empty input', 'listening', [], []), ('unknown event', 'listening', ['unsupported'], [{'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [3, 4, 5, 6, 7], 'received': [], 'burst': []}, 'frames': [['reject', [3, 4, 5, 6, 7]]]}])], 4: [('listening/turn_offer', 'listening', ['turn_offer'], [{'phase': 'offered', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [4, 5, 6, 7, 8, 9], 'received': [], 'burst': []}, 'frames': [['TURN_READY', 4]]}]), ('offered/turn_commit', 'offered', ['turn_commit'], [{'phase': 'speaking', 'registers': {'local_enabled': True, 'remote_enabled': False, 'offered': True, 'queue': [4, 5, 6, 7, 8, 9], 'received': [], 'burst': []}, 'frames': []}]), ('speaking/yield', 'speaking', ['yield'], [{'phase': 'yielding', 'registers': {'local_enabled': False, 'remote_enabled': False, 'offered': False, 'queue': [4, 5, 6, 7, 8, 9], 'received': [], 'burst': []}, 'frames': [['YIELD', 4]]}]), ('yielding/yield_ack', 'yielding', ['yield_ack'], [{'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [4, 5, 6, 7, 8, 9], 'received': [], 'burst': []}, 'frames': []}]), ('listening/remote_payload', 'listening', ['remote_payload'], [{'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [4, 5, 6, 7, 8, 9], 'received': [4, 5, 6, 7, 8, 9], 'burst': []}, 'frames': []}]), ('speaking/remote_payload', 'speaking', ['remote_payload'], [{'phase': 'speaking', 'registers': {'local_enabled': True, 'remote_enabled': False, 'offered': False, 'queue': [4, 5, 6, 7, 8, 9], 'received': [], 'burst': []}, 'frames': [['COLLISION', 4]]}]), ('listening/local_payload', 'listening', ['local_payload'], [{'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [4, 5, 6, 7, 8, 9, 4, 5, 6, 7, 8, 9], 'received': [], 'burst': []}, 'frames': []}]), ('offered/offer_withdrawn', 'offered', ['offer_withdrawn'], [{'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [4, 5, 6, 7, 8, 9], 'received': [], 'burst': []}, 'frames': []}]), ('yielding/local_payload', 'yielding', ['local_payload'], [{'phase': 'yielding', 'registers': {'local_enabled': False, 'remote_enabled': False, 'offered': False, 'queue': [4, 5, 6, 7, 8, 9, 4, 5, 6, 7, 8, 9], 'received': [], 'burst': []}, 'frames': []}]), ('listening/unsolicited_commit', 'listening', ['unsolicited_commit'], [{'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [4, 5, 6, 7, 8, 9], 'received': [], 'burst': []}, 'frames': [['NO_TURN_OFFER', 4]]}]), ('ordered trace 0', 'listening', ['turn_offer', 'offer_withdrawn', 'local_payload', 'unsolicited_commit', 'turn_offer', 'offer_withdrawn', 'local_payload'], [{'phase': 'offered', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [4, 5, 6, 7, 8, 9], 'received': [], 'burst': []}, 'frames': [['TURN_READY', 4]]}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [4, 5, 6, 7, 8, 9], 'received': [], 'burst': []}, 'frames': [['TURN_READY', 4]]}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [4, 5, 6, 7, 8, 9, 4, 5, 6, 7, 8, 9], 'received': [], 'burst': []}, 'frames': [['TURN_READY', 4]]}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [4, 5, 6, 7, 8, 9, 4, 5, 6, 7, 8, 9], 'received': [], 'burst': []}, 'frames': [['TURN_READY', 4], ['NO_TURN_OFFER', 4]]}, {'phase': 'offered', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [4, 5, 6, 7, 8, 9, 4, 5, 6, 7, 8, 9], 'received': [], 'burst': []}, 'frames': [['TURN_READY', 4], ['NO_TURN_OFFER', 4], ['TURN_READY', 4]]}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [4, 5, 6, 7, 8, 9, 4, 5, 6, 7, 8, 9], 'received': [], 'burst': []}, 'frames': [['TURN_READY', 4], ['NO_TURN_OFFER', 4], ['TURN_READY', 4]]}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [4, 5, 6, 7, 8, 9, 4, 5, 6, 7, 8, 9, 4, 5, 6, 7, 8, 9], 'received': [], 'burst': []}, 'frames': [['TURN_READY', 4], ['NO_TURN_OFFER', 4], ['TURN_READY', 4]]}]), ('ordered trace 3', 'yielding', ['local_payload', 'yield_ack', 'remote_payload', 'local_payload', 'unsolicited_commit', 'turn_offer', 'offer_withdrawn'], [{'phase': 'yielding', 'registers': {'local_enabled': False, 'remote_enabled': False, 'offered': False, 'queue': [4, 5, 6, 7, 8, 9, 4, 5, 6, 7, 8, 9], 'received': [], 'burst': []}, 'frames': []}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [4, 5, 6, 7, 8, 9, 4, 5, 6, 7, 8, 9], 'received': [], 'burst': []}, 'frames': []}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [4, 5, 6, 7, 8, 9, 4, 5, 6, 7, 8, 9], 'received': [4, 5, 6, 7, 8, 9], 'burst': []}, 'frames': []}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [4, 5, 6, 7, 8, 9, 4, 5, 6, 7, 8, 9, 4, 5, 6, 7, 8, 9], 'received': [4, 5, 6, 7, 8, 9], 'burst': []}, 'frames': []}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [4, 5, 6, 7, 8, 9, 4, 5, 6, 7, 8, 9, 4, 5, 6, 7, 8, 9], 'received': [4, 5, 6, 7, 8, 9], 'burst': []}, 'frames': [['NO_TURN_OFFER', 4]]}, {'phase': 'offered', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [4, 5, 6, 7, 8, 9, 4, 5, 6, 7, 8, 9, 4, 5, 6, 7, 8, 9], 'received': [4, 5, 6, 7, 8, 9], 'burst': []}, 'frames': [['NO_TURN_OFFER', 4], ['TURN_READY', 4]]}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [4, 5, 6, 7, 8, 9, 4, 5, 6, 7, 8, 9, 4, 5, 6, 7, 8, 9], 'received': [4, 5, 6, 7, 8, 9], 'burst': []}, 'frames': [['NO_TURN_OFFER', 4], ['TURN_READY', 4]]}]), ('empty input', 'listening', [], []), ('unknown event', 'listening', ['unsupported'], [{'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [4, 5, 6, 7, 8, 9], 'received': [], 'burst': []}, 'frames': [['reject', [4, 5, 6, 7, 8, 9]]]}])], 5: [('listening/turn_offer', 'listening', ['turn_offer'], [{'phase': 'offered', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [5, 6, 7, 8, 9, 10, 11], 'received': [], 'burst': []}, 'frames': [['TURN_READY', 5]]}]), ('offered/turn_commit', 'offered', ['turn_commit'], [{'phase': 'speaking', 'registers': {'local_enabled': True, 'remote_enabled': False, 'offered': True, 'queue': [5, 6, 7, 8, 9, 10, 11], 'received': [], 'burst': []}, 'frames': []}]), ('speaking/yield', 'speaking', ['yield'], [{'phase': 'yielding', 'registers': {'local_enabled': False, 'remote_enabled': False, 'offered': False, 'queue': [5, 6, 7, 8, 9, 10, 11], 'received': [], 'burst': []}, 'frames': [['YIELD', 5]]}]), ('yielding/yield_ack', 'yielding', ['yield_ack'], [{'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [5, 6, 7, 8, 9, 10, 11], 'received': [], 'burst': []}, 'frames': []}]), ('listening/remote_payload', 'listening', ['remote_payload'], [{'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [5, 6, 7, 8, 9, 10, 11], 'received': [5, 6, 7, 8, 9, 10, 11], 'burst': []}, 'frames': []}]), ('speaking/remote_payload', 'speaking', ['remote_payload'], [{'phase': 'speaking', 'registers': {'local_enabled': True, 'remote_enabled': False, 'offered': False, 'queue': [5, 6, 7, 8, 9, 10, 11], 'received': [], 'burst': []}, 'frames': [['COLLISION', 5]]}]), ('listening/local_payload', 'listening', ['local_payload'], [{'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11], 'received': [], 'burst': []}, 'frames': []}]), ('offered/offer_withdrawn', 'offered', ['offer_withdrawn'], [{'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [5, 6, 7, 8, 9, 10, 11], 'received': [], 'burst': []}, 'frames': []}]), ('yielding/local_payload', 'yielding', ['local_payload'], [{'phase': 'yielding', 'registers': {'local_enabled': False, 'remote_enabled': False, 'offered': False, 'queue': [5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11], 'received': [], 'burst': []}, 'frames': []}]), ('listening/unsolicited_commit', 'listening', ['unsolicited_commit'], [{'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [5, 6, 7, 8, 9, 10, 11], 'received': [], 'burst': []}, 'frames': [['NO_TURN_OFFER', 5]]}]), ('ordered trace 0', 'listening', ['turn_offer', 'offer_withdrawn', 'local_payload', 'unsolicited_commit', 'turn_offer', 'offer_withdrawn', 'local_payload', 'unsolicited_commit'], [{'phase': 'offered', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [5, 6, 7, 8, 9, 10, 11], 'received': [], 'burst': []}, 'frames': [['TURN_READY', 5]]}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [5, 6, 7, 8, 9, 10, 11], 'received': [], 'burst': []}, 'frames': [['TURN_READY', 5]]}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11], 'received': [], 'burst': []}, 'frames': [['TURN_READY', 5]]}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11], 'received': [], 'burst': []}, 'frames': [['TURN_READY', 5], ['NO_TURN_OFFER', 5]]}, {'phase': 'offered', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11], 'received': [], 'burst': []}, 'frames': [['TURN_READY', 5], ['NO_TURN_OFFER', 5], ['TURN_READY', 5]]}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11], 'received': [], 'burst': []}, 'frames': [['TURN_READY', 5], ['NO_TURN_OFFER', 5], ['TURN_READY', 5]]}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11], 'received': [], 'burst': []}, 'frames': [['TURN_READY', 5], ['NO_TURN_OFFER', 5], ['TURN_READY', 5]]}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11], 'received': [], 'burst': []}, 'frames': [['TURN_READY', 5], ['NO_TURN_OFFER', 5], ['TURN_READY', 5], ['NO_TURN_OFFER', 5]]}]), ('ordered trace 3', 'yielding', ['local_payload', 'yield_ack', 'remote_payload', 'local_payload', 'unsolicited_commit', 'turn_offer', 'offer_withdrawn', 'local_payload'], [{'phase': 'yielding', 'registers': {'local_enabled': False, 'remote_enabled': False, 'offered': False, 'queue': [5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11], 'received': [], 'burst': []}, 'frames': []}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11], 'received': [], 'burst': []}, 'frames': []}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11], 'received': [5, 6, 7, 8, 9, 10, 11], 'burst': []}, 'frames': []}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11], 'received': [5, 6, 7, 8, 9, 10, 11], 'burst': []}, 'frames': []}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11], 'received': [5, 6, 7, 8, 9, 10, 11], 'burst': []}, 'frames': [['NO_TURN_OFFER', 5]]}, {'phase': 'offered', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11], 'received': [5, 6, 7, 8, 9, 10, 11], 'burst': []}, 'frames': [['NO_TURN_OFFER', 5], ['TURN_READY', 5]]}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11], 'received': [5, 6, 7, 8, 9, 10, 11], 'burst': []}, 'frames': [['NO_TURN_OFFER', 5], ['TURN_READY', 5]]}, {'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11], 'received': [5, 6, 7, 8, 9, 10, 11], 'burst': []}, 'frames': [['NO_TURN_OFFER', 5], ['TURN_READY', 5]]}]), ('empty input', 'listening', [], []), ('unknown event', 'listening', ['unsupported'], [{'phase': 'listening', 'registers': {'local_enabled': False, 'remote_enabled': True, 'offered': False, 'queue': [5, 6, 7, 8, 9, 10, 11], 'received': [], 'burst': []}, 'frames': [['reject', [5, 6, 7, 8, 9, 10, 11]]]}])]}
for label, phase, events, expected in cases[N]:
    check(label, solve(phase, events, N), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
While offered, event turn_commit produces offered/wait instead of speaking/enable_transmit.

For the stipulated Half-duplex speaking-turn controller, initialize the explicitly shown resource registers from seed (1..5), then consume classified events sequentially. After each event return a deep snapshot of phase, resource registers, and cumulative emitted control frames. The explicit ten phase/event rules and their resource effects define admission and response semantics. Unlisted events preserve phase and emit rejection. Payload is the consecutive integers seed through 2*seed+1. Empty event input returns no observations.

split: open-access