X-Git-Url: https://git.njae.me.uk/?a=blobdiff_plain;f=bombe.ipynb;h=e28af9aac5316617032de9fa7f1becc61f6ccea5;hb=HEAD;hp=59442e4f4da5bf6481be0f923171939245d2c938;hpb=cc215dec21447bca7c2fb8016df255ab1aac512a;p=cipher-tools.git diff --git a/bombe.ipynb b/bombe.ipynb index 59442e4..e28af9a 100644 --- a/bombe.ipynb +++ b/bombe.ipynb @@ -77,7 +77,7 @@ "cell_type": "code", "execution_count": 4, "metadata": { - "collapsed": false + "collapsed": true }, "outputs": [], "source": [ @@ -116,6 +116,7 @@ " 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", @@ -163,7 +164,10 @@ " 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", @@ -201,7 +205,7 @@ "cell_type": "code", "execution_count": 5, "metadata": { - "collapsed": false + "collapsed": true }, "outputs": [], "source": [ @@ -228,9 +232,7 @@ { "cell_type": "code", "execution_count": 7, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "data": { @@ -253,9 +255,7 @@ { "cell_type": "code", "execution_count": 8, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "data": { @@ -275,9 +275,7 @@ { "cell_type": "code", "execution_count": 9, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "data": { @@ -328,9 +326,7 @@ { "cell_type": "code", "execution_count": 11, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "data": { @@ -367,9 +363,7 @@ { "cell_type": "code", "execution_count": 12, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "data": { @@ -390,7 +384,7 @@ "cell_type": "code", "execution_count": 13, "metadata": { - "collapsed": false + "collapsed": true }, "outputs": [], "source": [ @@ -400,9 +394,7 @@ { "cell_type": "code", "execution_count": 14, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "data": { @@ -422,9 +414,7 @@ { "cell_type": "code", "execution_count": 15, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -459,14 +449,12 @@ { "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, @@ -475,15 +463,53 @@ } ], "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": { @@ -516,7 +542,7 @@ " 'z': True}" ] }, - "execution_count": 17, + "execution_count": 19, "metadata": {}, "output_type": "execute_result" } @@ -527,10 +553,8 @@ }, { "cell_type": "code", - "execution_count": 18, - "metadata": { - "collapsed": false - }, + "execution_count": 20, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -578,10 +602,57 @@ }, { "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": { @@ -589,7 +660,7 @@ "('a', 'a', 'a')" ] }, - "execution_count": 19, + "execution_count": 22, "metadata": {}, "output_type": "execute_result" } @@ -600,10 +671,8 @@ }, { "cell_type": "code", - "execution_count": 20, - "metadata": { - "collapsed": false - }, + "execution_count": 23, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -638,9 +707,9 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": 24, "metadata": { - "collapsed": false + "collapsed": true }, "outputs": [], "source": [ @@ -650,10 +719,8 @@ }, { "cell_type": "code", - "execution_count": 22, - "metadata": { - "collapsed": false - }, + "execution_count": 25, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -704,10 +771,8 @@ }, { "cell_type": "code", - "execution_count": 23, - "metadata": { - "collapsed": false - }, + "execution_count": 26, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -758,10 +823,8 @@ }, { "cell_type": "code", - "execution_count": 24, - "metadata": { - "collapsed": false - }, + "execution_count": 27, + "metadata": {}, "outputs": [ { "data": { @@ -769,7 +832,7 @@ "1" ] }, - "execution_count": 24, + "execution_count": 27, "metadata": {}, "output_type": "execute_result" } @@ -780,9 +843,9 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": 28, "metadata": { - "collapsed": false + "collapsed": true }, "outputs": [], "source": [ @@ -793,9 +856,9 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": 29, "metadata": { - "collapsed": false + "collapsed": true }, "outputs": [], "source": [ @@ -806,10 +869,8 @@ }, { "cell_type": "code", - "execution_count": 27, - "metadata": { - "collapsed": false - }, + "execution_count": 30, + "metadata": {}, "outputs": [ { "data": { @@ -817,7 +878,7 @@ "('a', 'a', 'b')" ] }, - "execution_count": 27, + "execution_count": 30, "metadata": {}, "output_type": "execute_result" } @@ -828,10 +889,8 @@ }, { "cell_type": "code", - "execution_count": 28, - "metadata": { - "collapsed": false - }, + "execution_count": 31, + "metadata": {}, "outputs": [ { "data": { @@ -839,7 +898,7 @@ "False" ] }, - "execution_count": 28, + "execution_count": 31, "metadata": {}, "output_type": "execute_result" } @@ -850,10 +909,8 @@ }, { "cell_type": "code", - "execution_count": 29, - "metadata": { - "collapsed": false - }, + "execution_count": 32, + "metadata": {}, "outputs": [ { "data": { @@ -861,7 +918,7 @@ "('p', 'p', 'p')" ] }, - "execution_count": 29, + "execution_count": 32, "metadata": {}, "output_type": "execute_result" } @@ -872,10 +929,8 @@ }, { "cell_type": "code", - "execution_count": 30, - "metadata": { - "collapsed": false - }, + "execution_count": 33, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -923,10 +978,8 @@ }, { "cell_type": "code", - "execution_count": 31, - "metadata": { - "collapsed": false - }, + "execution_count": 34, + "metadata": {}, "outputs": [ { "data": { @@ -934,7 +987,7 @@ "17576" ] }, - "execution_count": 31, + "execution_count": 34, "metadata": {}, "output_type": "execute_result" } @@ -946,10 +999,8 @@ }, { "cell_type": "code", - "execution_count": 32, - "metadata": { - "collapsed": false - }, + "execution_count": 35, + "metadata": {}, "outputs": [ { "data": { @@ -957,7 +1008,7 @@ "(('a', 'a', 'b'), True)" ] }, - "execution_count": 32, + "execution_count": 35, "metadata": {}, "output_type": "execute_result" } @@ -969,9 +1020,9 @@ }, { "cell_type": "code", - "execution_count": 33, + "execution_count": 36, "metadata": { - "collapsed": false + "collapsed": true }, "outputs": [], "source": [ @@ -980,10 +1031,8 @@ }, { "cell_type": "code", - "execution_count": 34, - "metadata": { - "collapsed": false - }, + "execution_count": 37, + "metadata": {}, "outputs": [ { "data": { @@ -991,7 +1040,7 @@ "[('a', 'a', 'b')]" ] }, - "execution_count": 34, + "execution_count": 37, "metadata": {}, "output_type": "execute_result" } @@ -1007,7 +1056,7 @@ }, { "cell_type": "code", - "execution_count": 35, + "execution_count": 38, "metadata": { "collapsed": true }, @@ -1029,10 +1078,8 @@ }, { "cell_type": "code", - "execution_count": 36, - "metadata": { - "collapsed": false - }, + "execution_count": 39, + "metadata": {}, "outputs": [ { "data": { @@ -1040,7 +1087,7 @@ "[('a', 'a', 'b')]" ] }, - "execution_count": 36, + "execution_count": 39, "metadata": {}, "output_type": "execute_result" } @@ -1051,9 +1098,9 @@ }, { "cell_type": "code", - "execution_count": 37, + "execution_count": 40, "metadata": { - "collapsed": false + "collapsed": true }, "outputs": [], "source": [ @@ -1070,10 +1117,8 @@ }, { "cell_type": "code", - "execution_count": 38, - "metadata": { - "collapsed": false - }, + "execution_count": 41, + "metadata": {}, "outputs": [ { "data": { @@ -1081,7 +1126,7 @@ "('e', 'l', 'e')" ] }, - "execution_count": 38, + "execution_count": 41, "metadata": {}, "output_type": "execute_result" } @@ -1093,10 +1138,8 @@ }, { "cell_type": "code", - "execution_count": 39, - "metadata": { - "collapsed": false - }, + "execution_count": 42, + "metadata": {}, "outputs": [ { "data": { @@ -1104,7 +1147,7 @@ "'dhnpforeeimgg'" ] }, - "execution_count": 39, + "execution_count": 42, "metadata": {}, "output_type": "execute_result" } @@ -1118,10 +1161,8 @@ }, { "cell_type": "code", - "execution_count": 40, - "metadata": { - "collapsed": false - }, + "execution_count": 43, + "metadata": {}, "outputs": [ { "data": { @@ -1129,7 +1170,7 @@ "('j', 'e', 'o')" ] }, - "execution_count": 40, + "execution_count": 43, "metadata": {}, "output_type": "execute_result" } @@ -1140,10 +1181,8 @@ }, { "cell_type": "code", - "execution_count": 41, - "metadata": { - "collapsed": false - }, + "execution_count": 44, + "metadata": {}, "outputs": [ { "data": { @@ -1163,7 +1202,7 @@ " MenuIem(before='t', after='g', number=13)]" ] }, - "execution_count": 41, + "execution_count": 44, "metadata": {}, "output_type": "execute_result" } @@ -1175,9 +1214,8 @@ }, { "cell_type": "code", - "execution_count": 42, + "execution_count": 45, "metadata": { - "collapsed": false, "scrolled": true }, "outputs": [ @@ -1248,7 +1286,7 @@ " ('z', 'z', 'k')]" ] }, - "execution_count": 42, + "execution_count": 45, "metadata": {}, "output_type": "execute_result" } @@ -1265,10 +1303,8 @@ }, { "cell_type": "code", - "execution_count": 43, - "metadata": { - "collapsed": false - }, + "execution_count": 46, + "metadata": {}, "outputs": [ { "data": { @@ -1276,7 +1312,7 @@ "62" ] }, - "execution_count": 43, + "execution_count": 46, "metadata": {}, "output_type": "execute_result" } @@ -1287,9 +1323,8 @@ }, { "cell_type": "code", - "execution_count": 44, + "execution_count": 47, "metadata": { - "collapsed": false, "scrolled": true }, "outputs": [ @@ -1311,7 +1346,7 @@ " ('y', 'n', 'c')]" ] }, - "execution_count": 44, + "execution_count": 47, "metadata": {}, "output_type": "execute_result" } @@ -1328,10 +1363,8 @@ }, { "cell_type": "code", - "execution_count": 45, - "metadata": { - "collapsed": false - }, + "execution_count": 48, + "metadata": {}, "outputs": [ { "data": { @@ -1351,7 +1384,7 @@ " ('y', 'n', 'c')]" ] }, - "execution_count": 45, + "execution_count": 48, "metadata": {}, "output_type": "execute_result" } @@ -1362,9 +1395,9 @@ }, { "cell_type": "code", - "execution_count": 46, + "execution_count": 49, "metadata": { - "collapsed": false + "collapsed": true }, "outputs": [], "source": [ @@ -1379,10 +1412,8 @@ }, { "cell_type": "code", - "execution_count": 47, - "metadata": { - "collapsed": false - }, + "execution_count": 50, + "metadata": {}, "outputs": [ { "data": { @@ -1390,7 +1421,7 @@ "13" ] }, - "execution_count": 47, + "execution_count": 50, "metadata": {}, "output_type": "execute_result" } @@ -1401,9 +1432,9 @@ }, { "cell_type": "code", - "execution_count": 48, + "execution_count": 51, "metadata": { - "collapsed": false + "collapsed": true }, "outputs": [], "source": [ @@ -1413,10 +1444,8 @@ }, { "cell_type": "code", - "execution_count": 49, - "metadata": { - "collapsed": false - }, + "execution_count": 52, + "metadata": {}, "outputs": [ { "data": { @@ -1424,7 +1453,7 @@ "Signal(bank='e', wire='e')" ] }, - "execution_count": 49, + "execution_count": 52, "metadata": {}, "output_type": "execute_result" } @@ -1435,10 +1464,8 @@ }, { "cell_type": "code", - "execution_count": 50, - "metadata": { - "collapsed": false - }, + "execution_count": 53, + "metadata": {}, "outputs": [ { "data": { @@ -1446,7 +1473,7 @@ "True" ] }, - "execution_count": 50, + "execution_count": 53, "metadata": {}, "output_type": "execute_result" } @@ -1457,10 +1484,8 @@ }, { "cell_type": "code", - "execution_count": 51, - "metadata": { - "collapsed": false - }, + "execution_count": 54, + "metadata": {}, "outputs": [ { "data": { @@ -1468,7 +1493,7 @@ "True" ] }, - "execution_count": 51, + "execution_count": 54, "metadata": {}, "output_type": "execute_result" } @@ -1479,10 +1504,8 @@ }, { "cell_type": "code", - "execution_count": 52, - "metadata": { - "collapsed": false - }, + "execution_count": 55, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -1533,10 +1556,8 @@ }, { "cell_type": "code", - "execution_count": 53, - "metadata": { - "collapsed": false - }, + "execution_count": 56, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -1587,23 +1608,21 @@ }, { "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" } @@ -1615,10 +1634,8 @@ }, { "cell_type": "code", - "execution_count": 55, - "metadata": { - "collapsed": false - }, + "execution_count": 58, + "metadata": {}, "outputs": [ { "data": { @@ -1626,7 +1643,7 @@ "True" ] }, - "execution_count": 55, + "execution_count": 58, "metadata": {}, "output_type": "execute_result" } @@ -1637,21 +1654,19 @@ }, { "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" } @@ -1670,10 +1685,8 @@ }, { "cell_type": "code", - "execution_count": 57, - "metadata": { - "collapsed": false - }, + "execution_count": 60, + "metadata": {}, "outputs": [ { "data": { @@ -1681,7 +1694,7 @@ "False" ] }, - "execution_count": 57, + "execution_count": 60, "metadata": {}, "output_type": "execute_result" } @@ -1692,10 +1705,8 @@ }, { "cell_type": "code", - "execution_count": 58, - "metadata": { - "collapsed": false - }, + "execution_count": 61, + "metadata": {}, "outputs": [ { "data": { @@ -1703,7 +1714,7 @@ "False" ] }, - "execution_count": 58, + "execution_count": 61, "metadata": {}, "output_type": "execute_result" } @@ -1712,6 +1723,223 @@ "{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, @@ -1738,9 +1966,9 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.4.3+" + "version": "3.5.3" } }, "nbformat": 4, - "nbformat_minor": 0 + "nbformat_minor": 1 }