Updated for challenge 9
[cipher-tools.git] / bombe.ipynb
index 59442e4f4da5bf6481be0f923171939245d2c938..e28af9aac5316617032de9fa7f1becc61f6ccea5 100644 (file)
@@ -77,7 +77,7 @@
    "cell_type": "code",
    "execution_count": 4,
    "metadata": {
-    "collapsed": false
+    "collapsed": true
    },
    "outputs": [],
    "source": [
     "        self.connections += [Connection([bank_before, bank_after], scrambler)]\n",
     "        \n",
     "    def read_menu(self, menu):\n",
+    "        self.connections = []\n",
     "        for item in menu:\n",
     "            scrambler = Scrambler(self.wheel1_spec, self.wheel2_spec, self.wheel3_spec,\n",
     "                                  self.reflector_spec,\n",
     "                    self.pending += [Signal(current.wire, current.bank)]\n",
     "                for c in self.connections:\n",
     "                    if current.bank in c.banks:\n",
-    "                        other_bank = [b for b in c.banks if b != current.bank][0]\n",
+    "                        if len(set(c.banks)) == 1:\n",
+    "                            other_bank = c.banks[0]\n",
+    "                        else:\n",
+    "                            other_bank = [b for b in c.banks if b != current.bank][0]\n",
     "                        other_wire = c.scrambler.lookup(current.wire)\n",
     "                        # print(\"  adding\", other_bank, other_wire, \"because\", c.banks)\n",
     "                        self.pending += [Signal(other_bank, other_wire)]\n",
    "cell_type": "code",
    "execution_count": 5,
    "metadata": {
-    "collapsed": false
+    "collapsed": true
    },
    "outputs": [],
    "source": [
   {
    "cell_type": "code",
    "execution_count": 7,
-   "metadata": {
-    "collapsed": false
-   },
+   "metadata": {},
    "outputs": [
     {
      "data": {
   {
    "cell_type": "code",
    "execution_count": 8,
-   "metadata": {
-    "collapsed": false
-   },
+   "metadata": {},
    "outputs": [
     {
      "data": {
   {
    "cell_type": "code",
    "execution_count": 9,
-   "metadata": {
-    "collapsed": false
-   },
+   "metadata": {},
    "outputs": [
     {
      "data": {
   {
    "cell_type": "code",
    "execution_count": 11,
-   "metadata": {
-    "collapsed": false
-   },
+   "metadata": {},
    "outputs": [
     {
      "data": {
   {
    "cell_type": "code",
    "execution_count": 12,
-   "metadata": {
-    "collapsed": false
-   },
+   "metadata": {},
    "outputs": [
     {
      "data": {
    "cell_type": "code",
    "execution_count": 13,
    "metadata": {
-    "collapsed": false
+    "collapsed": true
    },
    "outputs": [],
    "source": [
   {
    "cell_type": "code",
    "execution_count": 14,
-   "metadata": {
-    "collapsed": false
-   },
+   "metadata": {},
    "outputs": [
     {
      "data": {
   {
    "cell_type": "code",
    "execution_count": 15,
-   "metadata": {
-    "collapsed": false
-   },
+   "metadata": {},
    "outputs": [
     {
      "name": "stdout",
   {
    "cell_type": "code",
    "execution_count": 16,
-   "metadata": {
-    "collapsed": false
-   },
+   "metadata": {},
    "outputs": [
     {
      "data": {
       "text/plain": [
-       "False"
+       "'ot:hp:gi:ns:di:sx:ac:rt:ew:os:mt:mn:el:ns:es:ac:gj:ez'"
       ]
      },
      "execution_count": 16,
     }
    ],
    "source": [
-    "bombe.test(Signal('t', 't'))"
+    "':'.join(cat(sorted(c.banks)) for c in bombe.connections)"
    ]
   },
   {
    "cell_type": "code",
    "execution_count": 17,
-   "metadata": {
-    "collapsed": false
-   },
+   "metadata": {},
+   "outputs": [
+    {
+     "data": {
+      "text/plain": [
+       "'aaa:aab:aac:aad:aae:aaf:aag:aah:aai:aaj:aak:aal:aam:aan:aao:aap:aaq:aar'"
+      ]
+     },
+     "execution_count": 17,
+     "metadata": {},
+     "output_type": "execute_result"
+    }
+   ],
+   "source": [
+    "':'.join(cat(c.scrambler.wheel_positions_l) for c in bombe.connections)"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 18,
+   "metadata": {},
+   "outputs": [
+    {
+     "data": {
+      "text/plain": [
+       "False"
+      ]
+     },
+     "execution_count": 18,
+     "metadata": {},
+     "output_type": "execute_result"
+    }
+   ],
+   "source": [
+    "bombe.test(Signal('t', 't'))"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 19,
+   "metadata": {},
    "outputs": [
     {
      "data": {
        " 'z': True}"
       ]
      },
-     "execution_count": 17,
+     "execution_count": 19,
      "metadata": {},
      "output_type": "execute_result"
     }
   },
   {
    "cell_type": "code",
-   "execution_count": 18,
-   "metadata": {
-    "collapsed": false
-   },
+   "execution_count": 20,
+   "metadata": {},
    "outputs": [
     {
      "name": "stdout",
   },
   {
    "cell_type": "code",
-   "execution_count": 19,
-   "metadata": {
-    "collapsed": false
-   },
+   "execution_count": 21,
+   "metadata": {},
+   "outputs": [
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "a : abcdefghijklmnopqrstuvwxyz\n",
+      "b : a.cde.ghij.lmnop.rst..wx.z\n",
+      "c : abcdefghijklmnopqrstuvwxyz\n",
+      "d : abcdefghijklmnopqrstuvwx.z\n",
+      "e : abcdefghijklmnopqrstuvwxyz\n",
+      "f : a.cde.ghij.lmnop.rst..wx.z\n",
+      "g : abcdefghijklmnopqrst.vwxyz\n",
+      "h : abcdefghijklmnopqrstuvwxyz\n",
+      "i : abcdefghijklmnopqrstu.wxyz\n",
+      "j : abcdefghi.klmnopqrstuvwxyz\n",
+      "k : a.cde.ghij.lmnop.rst..wx.z\n",
+      "l : abcdefghijklmnopqrstuvwxyz\n",
+      "m : abcdefghijklmnopqrstuvwxyz\n",
+      "n : abcdefghijklmnopqrstuvwxyz\n",
+      "o : abcdefghijklmnopqrstuvwxyz\n",
+      "p : abcdefghijklmnopqrstuvwxyz\n",
+      "q : a.cde.ghij.lmnop.rst..wx.z\n",
+      "r : abcdefghijklmnopqrstuvwxyz\n",
+      "s : abcdefghijklmnopqrstuvwxyz\n",
+      "t : abcdefghijklmnopqrstuvwxyz\n",
+      "u : a.cde..hij.lmnop.rst..wx.z\n",
+      "v : a.cde.gh.j.lmnop.rst..wx.z\n",
+      "w : abcdefghijklmnopqrstuvwxyz\n",
+      "x : abcdefghijklmnopqrstuvwxyz\n",
+      "y : a.c.e.ghij.lmnop.rst..wx.z\n",
+      "z : abcdefghijklmnopqrstuvwxyz\n"
+     ]
+    }
+   ],
+   "source": [
+    "for b in sorted(bombe.banks):\n",
+    "    print(b, ': ', end='')\n",
+    "    for w in sorted(bombe.banks[b]):\n",
+    "        if bombe.banks[b][w]:\n",
+    "            print(w, end='')\n",
+    "        else:\n",
+    "            print('.', end='')\n",
+    "    print('')"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 22,
+   "metadata": {},
    "outputs": [
     {
      "data": {
        "('a', 'a', 'a')"
       ]
      },
-     "execution_count": 19,
+     "execution_count": 22,
      "metadata": {},
      "output_type": "execute_result"
     }
   },
   {
    "cell_type": "code",
-   "execution_count": 20,
-   "metadata": {
-    "collapsed": false
-   },
+   "execution_count": 23,
+   "metadata": {},
    "outputs": [
     {
      "name": "stdout",
   },
   {
    "cell_type": "code",
-   "execution_count": 21,
+   "execution_count": 24,
    "metadata": {
-    "collapsed": false
+    "collapsed": true
    },
    "outputs": [],
    "source": [
   },
   {
    "cell_type": "code",
-   "execution_count": 22,
-   "metadata": {
-    "collapsed": false
-   },
+   "execution_count": 25,
+   "metadata": {},
    "outputs": [
     {
      "name": "stdout",
   },
   {
    "cell_type": "code",
-   "execution_count": 23,
-   "metadata": {
-    "collapsed": false
-   },
+   "execution_count": 26,
+   "metadata": {},
    "outputs": [
     {
      "name": "stdout",
   },
   {
    "cell_type": "code",
-   "execution_count": 24,
-   "metadata": {
-    "collapsed": false
-   },
+   "execution_count": 27,
+   "metadata": {},
    "outputs": [
     {
      "data": {
        "1"
       ]
      },
-     "execution_count": 24,
+     "execution_count": 27,
      "metadata": {},
      "output_type": "execute_result"
     }
   },
   {
    "cell_type": "code",
-   "execution_count": 25,
+   "execution_count": 28,
    "metadata": {
-    "collapsed": false
+    "collapsed": true
    },
    "outputs": [],
    "source": [
   },
   {
    "cell_type": "code",
-   "execution_count": 26,
+   "execution_count": 29,
    "metadata": {
-    "collapsed": false
+    "collapsed": true
    },
    "outputs": [],
    "source": [
   },
   {
    "cell_type": "code",
-   "execution_count": 27,
-   "metadata": {
-    "collapsed": false
-   },
+   "execution_count": 30,
+   "metadata": {},
    "outputs": [
     {
      "data": {
        "('a', 'a', 'b')"
       ]
      },
-     "execution_count": 27,
+     "execution_count": 30,
      "metadata": {},
      "output_type": "execute_result"
     }
   },
   {
    "cell_type": "code",
-   "execution_count": 28,
-   "metadata": {
-    "collapsed": false
-   },
+   "execution_count": 31,
+   "metadata": {},
    "outputs": [
     {
      "data": {
        "False"
       ]
      },
-     "execution_count": 28,
+     "execution_count": 31,
      "metadata": {},
      "output_type": "execute_result"
     }
   },
   {
    "cell_type": "code",
-   "execution_count": 29,
-   "metadata": {
-    "collapsed": false
-   },
+   "execution_count": 32,
+   "metadata": {},
    "outputs": [
     {
      "data": {
        "('p', 'p', 'p')"
       ]
      },
-     "execution_count": 29,
+     "execution_count": 32,
      "metadata": {},
      "output_type": "execute_result"
     }
   },
   {
    "cell_type": "code",
-   "execution_count": 30,
-   "metadata": {
-    "collapsed": false
-   },
+   "execution_count": 33,
+   "metadata": {},
    "outputs": [
     {
      "name": "stdout",
   },
   {
    "cell_type": "code",
-   "execution_count": 31,
-   "metadata": {
-    "collapsed": false
-   },
+   "execution_count": 34,
+   "metadata": {},
    "outputs": [
     {
      "data": {
        "17576"
       ]
      },
-     "execution_count": 31,
+     "execution_count": 34,
      "metadata": {},
      "output_type": "execute_result"
     }
   },
   {
    "cell_type": "code",
-   "execution_count": 32,
-   "metadata": {
-    "collapsed": false
-   },
+   "execution_count": 35,
+   "metadata": {},
    "outputs": [
     {
      "data": {
        "(('a', 'a', 'b'), True)"
       ]
      },
-     "execution_count": 32,
+     "execution_count": 35,
      "metadata": {},
      "output_type": "execute_result"
     }
   },
   {
    "cell_type": "code",
-   "execution_count": 33,
+   "execution_count": 36,
    "metadata": {
-    "collapsed": false
+    "collapsed": true
    },
    "outputs": [],
    "source": [
   },
   {
    "cell_type": "code",
-   "execution_count": 34,
-   "metadata": {
-    "collapsed": false
-   },
+   "execution_count": 37,
+   "metadata": {},
    "outputs": [
     {
      "data": {
        "[('a', 'a', 'b')]"
       ]
      },
-     "execution_count": 34,
+     "execution_count": 37,
      "metadata": {},
      "output_type": "execute_result"
     }
   },
   {
    "cell_type": "code",
-   "execution_count": 35,
+   "execution_count": 38,
    "metadata": {
     "collapsed": true
    },
   },
   {
    "cell_type": "code",
-   "execution_count": 36,
-   "metadata": {
-    "collapsed": false
-   },
+   "execution_count": 39,
+   "metadata": {},
    "outputs": [
     {
      "data": {
        "[('a', 'a', 'b')]"
       ]
      },
-     "execution_count": 36,
+     "execution_count": 39,
      "metadata": {},
      "output_type": "execute_result"
     }
   },
   {
    "cell_type": "code",
-   "execution_count": 37,
+   "execution_count": 40,
    "metadata": {
-    "collapsed": false
+    "collapsed": true
    },
    "outputs": [],
    "source": [
   },
   {
    "cell_type": "code",
-   "execution_count": 38,
-   "metadata": {
-    "collapsed": false
-   },
+   "execution_count": 41,
+   "metadata": {},
    "outputs": [
     {
      "data": {
        "('e', 'l', 'e')"
       ]
      },
-     "execution_count": 38,
+     "execution_count": 41,
      "metadata": {},
      "output_type": "execute_result"
     }
   },
   {
    "cell_type": "code",
-   "execution_count": 39,
-   "metadata": {
-    "collapsed": false
-   },
+   "execution_count": 42,
+   "metadata": {},
    "outputs": [
     {
      "data": {
        "'dhnpforeeimgg'"
       ]
      },
-     "execution_count": 39,
+     "execution_count": 42,
      "metadata": {},
      "output_type": "execute_result"
     }
   },
   {
    "cell_type": "code",
-   "execution_count": 40,
-   "metadata": {
-    "collapsed": false
-   },
+   "execution_count": 43,
+   "metadata": {},
    "outputs": [
     {
      "data": {
        "('j', 'e', 'o')"
       ]
      },
-     "execution_count": 40,
+     "execution_count": 43,
      "metadata": {},
      "output_type": "execute_result"
     }
   },
   {
    "cell_type": "code",
-   "execution_count": 41,
-   "metadata": {
-    "collapsed": false
-   },
+   "execution_count": 44,
+   "metadata": {},
    "outputs": [
     {
      "data": {
        " MenuIem(before='t', after='g', number=13)]"
       ]
      },
-     "execution_count": 41,
+     "execution_count": 44,
      "metadata": {},
      "output_type": "execute_result"
     }
   },
   {
    "cell_type": "code",
-   "execution_count": 42,
+   "execution_count": 45,
    "metadata": {
-    "collapsed": false,
     "scrolled": true
    },
    "outputs": [
        " ('z', 'z', 'k')]"
       ]
      },
-     "execution_count": 42,
+     "execution_count": 45,
      "metadata": {},
      "output_type": "execute_result"
     }
   },
   {
    "cell_type": "code",
-   "execution_count": 43,
-   "metadata": {
-    "collapsed": false
-   },
+   "execution_count": 46,
+   "metadata": {},
    "outputs": [
     {
      "data": {
        "62"
       ]
      },
-     "execution_count": 43,
+     "execution_count": 46,
      "metadata": {},
      "output_type": "execute_result"
     }
   },
   {
    "cell_type": "code",
-   "execution_count": 44,
+   "execution_count": 47,
    "metadata": {
-    "collapsed": false,
     "scrolled": true
    },
    "outputs": [
        " ('y', 'n', 'c')]"
       ]
      },
-     "execution_count": 44,
+     "execution_count": 47,
      "metadata": {},
      "output_type": "execute_result"
     }
   },
   {
    "cell_type": "code",
-   "execution_count": 45,
-   "metadata": {
-    "collapsed": false
-   },
+   "execution_count": 48,
+   "metadata": {},
    "outputs": [
     {
      "data": {
        " ('y', 'n', 'c')]"
       ]
      },
-     "execution_count": 45,
+     "execution_count": 48,
      "metadata": {},
      "output_type": "execute_result"
     }
   },
   {
    "cell_type": "code",
-   "execution_count": 46,
+   "execution_count": 49,
    "metadata": {
-    "collapsed": false
+    "collapsed": true
    },
    "outputs": [],
    "source": [
   },
   {
    "cell_type": "code",
-   "execution_count": 47,
-   "metadata": {
-    "collapsed": false
-   },
+   "execution_count": 50,
+   "metadata": {},
    "outputs": [
     {
      "data": {
        "13"
       ]
      },
-     "execution_count": 47,
+     "execution_count": 50,
      "metadata": {},
      "output_type": "execute_result"
     }
   },
   {
    "cell_type": "code",
-   "execution_count": 48,
+   "execution_count": 51,
    "metadata": {
-    "collapsed": false
+    "collapsed": true
    },
    "outputs": [],
    "source": [
   },
   {
    "cell_type": "code",
-   "execution_count": 49,
-   "metadata": {
-    "collapsed": false
-   },
+   "execution_count": 52,
+   "metadata": {},
    "outputs": [
     {
      "data": {
        "Signal(bank='e', wire='e')"
       ]
      },
-     "execution_count": 49,
+     "execution_count": 52,
      "metadata": {},
      "output_type": "execute_result"
     }
   },
   {
    "cell_type": "code",
-   "execution_count": 50,
-   "metadata": {
-    "collapsed": false
-   },
+   "execution_count": 53,
+   "metadata": {},
    "outputs": [
     {
      "data": {
        "True"
       ]
      },
-     "execution_count": 50,
+     "execution_count": 53,
      "metadata": {},
      "output_type": "execute_result"
     }
   },
   {
    "cell_type": "code",
-   "execution_count": 51,
-   "metadata": {
-    "collapsed": false
-   },
+   "execution_count": 54,
+   "metadata": {},
    "outputs": [
     {
      "data": {
        "True"
       ]
      },
-     "execution_count": 51,
+     "execution_count": 54,
      "metadata": {},
      "output_type": "execute_result"
     }
   },
   {
    "cell_type": "code",
-   "execution_count": 52,
-   "metadata": {
-    "collapsed": false
-   },
+   "execution_count": 55,
+   "metadata": {},
    "outputs": [
     {
      "name": "stdout",
   },
   {
    "cell_type": "code",
-   "execution_count": 53,
-   "metadata": {
-    "collapsed": false
-   },
+   "execution_count": 56,
+   "metadata": {},
    "outputs": [
     {
      "name": "stdout",
   },
   {
    "cell_type": "code",
-   "execution_count": 54,
-   "metadata": {
-    "collapsed": false
-   },
+   "execution_count": 57,
+   "metadata": {},
    "outputs": [
     {
      "data": {
       "text/plain": [
-       "{frozenset({'m'}),\n",
+       "{frozenset({'t', 'x'}),\n",
        " frozenset({'i', 'n'}),\n",
-       " frozenset({'f', 'p'}),\n",
-       " frozenset({'t', 'x'}),\n",
+       " frozenset({'m'}),\n",
        " frozenset({'e', 'y'}),\n",
+       " frozenset({'f', 'p'}),\n",
        " frozenset({'b', 'g'})}"
       ]
      },
-     "execution_count": 54,
+     "execution_count": 57,
      "metadata": {},
      "output_type": "execute_result"
     }
   },
   {
    "cell_type": "code",
-   "execution_count": 55,
-   "metadata": {
-    "collapsed": false
-   },
+   "execution_count": 58,
+   "metadata": {},
    "outputs": [
     {
      "data": {
        "True"
       ]
      },
-     "execution_count": 55,
+     "execution_count": 58,
      "metadata": {},
      "output_type": "execute_result"
     }
   },
   {
    "cell_type": "code",
-   "execution_count": 56,
-   "metadata": {
-    "collapsed": false
-   },
+   "execution_count": 59,
+   "metadata": {},
    "outputs": [
     {
      "data": {
       "text/plain": [
-       "({frozenset({1, 2}), frozenset({3, 4}), frozenset({2, 3})},\n",
+       "({frozenset({1, 2}), frozenset({2, 3}), frozenset({3, 4})},\n",
        " frozenset({1, 2}),\n",
        " frozenset({3, 4}),\n",
        " frozenset({2, 3}))"
       ]
      },
-     "execution_count": 56,
+     "execution_count": 59,
      "metadata": {},
      "output_type": "execute_result"
     }
   },
   {
    "cell_type": "code",
-   "execution_count": 57,
-   "metadata": {
-    "collapsed": false
-   },
+   "execution_count": 60,
+   "metadata": {},
    "outputs": [
     {
      "data": {
        "False"
       ]
      },
-     "execution_count": 57,
+     "execution_count": 60,
      "metadata": {},
      "output_type": "execute_result"
     }
   },
   {
    "cell_type": "code",
-   "execution_count": 58,
-   "metadata": {
-    "collapsed": false
-   },
+   "execution_count": 61,
+   "metadata": {},
    "outputs": [
     {
      "data": {
        "False"
       ]
      },
-     "execution_count": 58,
+     "execution_count": 61,
      "metadata": {},
      "output_type": "execute_result"
     }
     "{1, 2}.isdisjoint({1, 6})"
    ]
   },
+  {
+   "cell_type": "markdown",
+   "metadata": {
+    "collapsed": true
+   },
+   "source": [
+    "# Tsest"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 62,
+   "metadata": {},
+   "outputs": [
+    {
+     "data": {
+      "text/plain": [
+       "'slgncszxltkzebghstgywdmpr'"
+      ]
+     },
+     "execution_count": 62,
+     "metadata": {},
+     "output_type": "execute_result"
+    }
+   ],
+   "source": [
+    "target_ct = ''.join(c.lower() for c in 'SLGNC SZXLT KZEBG HSTGY WDMPR' if c in string.ascii_letters)\n",
+    "target_ct"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 63,
+   "metadata": {},
+   "outputs": [
+    {
+     "data": {
+      "text/plain": [
+       "'theyweredetectedbybritishshipsinclud'"
+      ]
+     },
+     "execution_count": 63,
+     "metadata": {},
+     "output_type": "execute_result"
+    }
+   ],
+   "source": [
+    "target_pt = ''.join(c.lower() for c in 'Theyw erede tecte d byBri tishs hipsi nclud' if c in string.ascii_letters)\n",
+    "target_pt"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 64,
+   "metadata": {},
+   "outputs": [
+    {
+     "data": {
+      "text/plain": [
+       "[MenuIem(before='w', after='c', number=1),\n",
+       " MenuIem(before='e', after='s', number=2),\n",
+       " MenuIem(before='r', after='z', number=3),\n",
+       " MenuIem(before='e', after='x', number=4),\n",
+       " MenuIem(before='d', after='l', number=5),\n",
+       " MenuIem(before='e', after='t', number=6),\n",
+       " MenuIem(before='t', after='k', number=7),\n",
+       " MenuIem(before='e', after='z', number=8),\n",
+       " MenuIem(before='c', after='e', number=9),\n",
+       " MenuIem(before='t', after='b', number=10),\n",
+       " MenuIem(before='e', after='g', number=11),\n",
+       " MenuIem(before='d', after='h', number=12),\n",
+       " MenuIem(before='b', after='s', number=13),\n",
+       " MenuIem(before='y', after='t', number=14),\n",
+       " MenuIem(before='b', after='g', number=15),\n",
+       " MenuIem(before='r', after='y', number=16),\n",
+       " MenuIem(before='i', after='w', number=17),\n",
+       " MenuIem(before='t', after='d', number=18),\n",
+       " MenuIem(before='i', after='m', number=19),\n",
+       " MenuIem(before='s', after='p', number=20)]"
+      ]
+     },
+     "execution_count": 64,
+     "metadata": {},
+     "output_type": "execute_result"
+    }
+   ],
+   "source": [
+    "tbt_menu = [MenuItem(p, c, i+1) for i, (p, c) in enumerate(zip(target_pt[4:24], target_ct[4:24]))]\n",
+    "tbt_menu"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 65,
+   "metadata": {
+    "collapsed": true
+   },
+   "outputs": [],
+   "source": [
+    "tbt_bombe = Bombe(wheel_iii_spec, wheel_i_spec, wheel_ii_spec, reflector_b_spec, \n",
+    "                         menu=tbt_menu)"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 66,
+   "metadata": {},
+   "outputs": [
+    {
+     "data": {
+      "text/plain": [
+       "[('k', 'r', 'n')]"
+      ]
+     },
+     "execution_count": 66,
+     "metadata": {},
+     "output_type": "execute_result"
+    }
+   ],
+   "source": [
+    "tbt_wheel_posns = run_multi_bombe(wheel_iii_spec, wheel_i_spec, wheel_ii_spec, reflector_b_spec, tbt_menu)\n",
+    "tbt_wheel_posns"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 67,
+   "metadata": {},
+   "outputs": [
+    {
+     "data": {
+      "text/plain": [
+       "Signal(bank='e', wire='e')"
+      ]
+     },
+     "execution_count": 67,
+     "metadata": {},
+     "output_type": "execute_result"
+    }
+   ],
+   "source": [
+    "tbt_bombe.test_start"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 68,
+   "metadata": {},
+   "outputs": [
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "False\n",
+      "a : abcdefghi..lmnop.rst.v.x.z\n",
+      "b : a...ef.hi..lmnop.r.t...x..\n",
+      "c : a..defg.i..lmn.p.rst...x..\n",
+      "d : a.c.efghi.klmnopqrstu.wxyz\n",
+      "e : abcdefghijklmnopqrstuvwx.z\n",
+      "f : abcdefghijklmno.qrstuvwxyz\n",
+      "g : a.cdefghijklmnopqrstuvwxyz\n",
+      "h : ab.defghi...mnopqrstuvwxyz\n",
+      "i : abcdefghijklm.opqrstuvwxyz\n",
+      "j : ....efg.i..lmnop...t...x..\n",
+      "k : ...defg.i..lmn.p..st...x..\n",
+      "l : abcdefg.ijklmnopqrstuv.x..\n",
+      "m : abcdefghijkl.nopqrstuvwxyz\n",
+      "n : abcdefgh.jklmnopqrstuvwxyz\n",
+      "o : ab.defghij.lmnop.r.tuvwxyz\n",
+      "p : abcde.ghijklmnopqrstuvwxyz\n",
+      "q : ...defghi..lmn.p..st...x..\n",
+      "r : abcdefghi..lmnop.rst.v.x.z\n",
+      "s : a.cdefghi.klmn.pqr.tuvwxyz\n",
+      "t : abcdefghijklmnopqrstuvw.yz\n",
+      "u : ...defghi..lmnop..st...x..\n",
+      "v : a...efghi..lmnop.rst...x..\n",
+      "w : ...defghi...mnop..st...x..\n",
+      "x : abcdefghijklmnopqrs.uvwxyz\n",
+      "y : ...d.fghi...mnop..st...x..\n",
+      "z : a..defghi...mnop.rst...x..\n"
+     ]
+    }
+   ],
+   "source": [
+    "r = tbt_bombe.test(start_positions=('l', 's', 'd'))\n",
+    "print(r)\n",
+    "for b in sorted(w_bombe.banks):\n",
+    "    print(b, ': ', end='')\n",
+    "    for w in sorted(w_bombe.banks[b]):\n",
+    "        if w_bombe.banks[b][w]:\n",
+    "            print(w, end='')\n",
+    "        else:\n",
+    "            print('.', end='')\n",
+    "    print('')\n"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 69,
+   "metadata": {},
+   "outputs": [
+    {
+     "data": {
+      "text/plain": [
+       "set()"
+      ]
+     },
+     "execution_count": 69,
+     "metadata": {},
+     "output_type": "execute_result"
+    }
+   ],
+   "source": [
+    "ps = tbt_bombe.possible_plugboards()\n",
+    "ps"
+   ]
+  },
   {
    "cell_type": "code",
    "execution_count": null,
    "name": "python",
    "nbconvert_exporter": "python",
    "pygments_lexer": "ipython3",
-   "version": "3.4.3+"
+   "version": "3.5.3"
   }
  },
  "nbformat": 4,
- "nbformat_minor": 0
+ "nbformat_minor": 1
 }