Added slides
authorNeil Smith <neil.git@njae.me.uk>
Thu, 9 Oct 2014 20:28:16 +0000 (21:28 +0100)
committerNeil Smith <neil.git@njae.me.uk>
Thu, 9 Oct 2014 20:28:16 +0000 (21:28 +0100)
euler-14.ipynb
hangman-better.ipynb

index 0128d75ed1b3639bdf97df7b00fc4e10110ed675..5e33a37ce0666ba304ee2405b487e837091def15 100644 (file)
@@ -1,7 +1,7 @@
 {
  "metadata": {
   "name": "",
-  "signature": "sha256:910fd3bd845f28d453d531005afb4e6d3ce4f040aa35835ad49dbb76f9e611fa"
+  "signature": "sha256:179e1a009d7b8bf549e9cff5cea48e2a90bc80b3c370cc110bc7f40a7cae7a9f"
  },
  "nbformat": 3,
  "nbformat_minor": 0,
      "language": "python",
      "metadata": {},
      "outputs": [],
-     "prompt_number": 88
+     "prompt_number": 1
     },
     {
      "cell_type": "code",
       {
        "metadata": {},
        "output_type": "pyout",
-       "prompt_number": 89,
+       "prompt_number": 2,
        "text": [
         "20"
        ]
       }
      ],
-     "prompt_number": 89
+     "prompt_number": 2
     },
     {
      "cell_type": "code",
       {
        "metadata": {},
        "output_type": "pyout",
-       "prompt_number": 90,
+       "prompt_number": 3,
        "text": [
         "{1: 1,\n",
         " 2: 2,\n",
        ]
       }
      ],
-     "prompt_number": 90
+     "prompt_number": 3
     },
     {
      "cell_type": "code",
         "6171 -> 262\n",
         "6171 -> 262\n",
         "6171 -> 262\n",
-        "6171 -> 262\n",
         "6171"
        ]
       },
         "6171 -> 262\n",
         "6171 -> 262\n",
         "6171 -> 262\n",
-        "6171 -> 262\n",
         "6171"
        ]
       },
         "6171 -> 262\n",
         "6171 -> 262\n",
         "6171 -> 262\n",
-        "6171 -> 262\n",
-        "6171 -> 262\n",
         "6171"
        ]
       },
         "6171 -> 262\n",
         "6171 -> 262\n",
         "6171 -> 262\n",
-        "6171 -> 262\n",
         "6171"
        ]
       },
         "6171 -> 262\n",
         "6171 -> 262\n",
         "6171 -> 262\n",
-        "6171 -> 262\n",
         "6171"
        ]
       },
         "6171 -> 262\n",
         "6171 -> 262\n",
         "6171 -> 262\n",
-        "6171 -> 262\n",
         "6171"
        ]
       },
         "6171 -> 262\n",
         "6171 -> 262\n",
         "6171 -> 262\n",
-        "6171 -> 262\n",
         "6171"
        ]
       },
         "6171 -> 262\n",
         "6171 -> 262\n",
         "6171 -> 262\n",
+        "6171 -> 262\n",
+        "6171 -> 262\n",
+        "6171 -> 262\n",
+        "6171 -> 262\n",
+        "6171 -> 262\n",
+        "6171 -> 262\n",
+        "6171 -> 262\n",
+        "6171 -> 262\n",
         "100 loops, best of 3: 2.03 ms per loop\n"
        ]
       }
      ],
-     "prompt_number": 93
+     "prompt_number": 4
     },
     {
      "cell_type": "code",
        "stream": "stdout",
        "text": [
         " -> 525\n",
-        "1 loops, best of 3: 248 ms per loop\n"
+        "1 loops, best of 3: 250 ms per loop\n"
        ]
       }
      ],
-     "prompt_number": 94
+     "prompt_number": 5
     },
     {
      "cell_type": "markdown",
      "language": "python",
      "metadata": {},
      "outputs": [],
-     "prompt_number": 95
+     "prompt_number": 6
     },
     {
      "cell_type": "code",
        "stream": "stdout",
        "text": [
         " -> 525\n",
-        "1 loops, best of 3: 851 ms per loop\n"
+        "1 loops, best of 3: 785 ms per loop\n"
        ]
       }
      ],
-     "prompt_number": 96
+     "prompt_number": 7
     },
     {
      "cell_type": "code",
index 96c61fe786d71be1d42661beb4e49de12ccf2f16..87426dd5baf2deff12c7179f7fe8ad79a9f2d924 100644 (file)
@@ -1,7 +1,7 @@
 {
  "metadata": {
   "name": "",
-  "signature": "sha256:b93ed7f85302bd806b23e539f31a6d8afd7554cafe052439a06de6aa5a19b08d"
+  "signature": "sha256:6b8d6551e13b3d60196077d54315af6fd1f78b4de386098da7115fe7cf3112fb"
  },
  "nbformat": 3,
  "nbformat_minor": 0,
@@ -44,7 +44,7 @@
      "language": "python",
      "metadata": {},
      "outputs": [],
-     "prompt_number": 12
+     "prompt_number": 3
     },
     {
      "cell_type": "code",
       "        return guess\n",
       "    \n",
       "    def play_game(self):\n",
-      "        self.do_turn()\n",
       "        while not self.game_finished:\n",
       "            self.do_turn()\n",
       "        if not self.player:\n",
      "language": "python",
      "metadata": {},
      "outputs": [],
-     "prompt_number": 5
+     "prompt_number": 37
     },
     {
      "cell_type": "code",
        "output_type": "stream",
        "stream": "stdout",
        "text": [
-        "55\n"
+        "42\n"
        ]
       }
      ],
-     "prompt_number": 8
+     "prompt_number": 38
     },
     {
      "cell_type": "code",
        "output_type": "stream",
        "stream": "stdout",
        "text": [
-        "336\n"
+        "330\n"
        ]
       }
      ],
        "output_type": "stream",
        "stream": "stdout",
        "text": [
-        "4\n"
+        "8\n"
        ]
       }
      ],
      "language": "python",
      "metadata": {},
      "outputs": [],
-     "prompt_number": 17
+     "prompt_number": 11
     },
     {
      "cell_type": "code",
       {
        "metadata": {},
        "output_type": "pyout",
-       "prompt_number": 18,
+       "prompt_number": 12,
        "text": [
         "Counter({'s': 91332, 'e': 88692, 'i': 66900, 'a': 64468, 'r': 57460, 'n': 57128, 't': 52949, 'o': 49121, 'l': 40995, 'c': 31854, 'd': 28505, 'u': 26372, 'g': 22693, 'm': 22549, 'p': 22249, 'h': 19337, 'b': 15540, 'y': 12652, 'f': 10679, 'k': 8386, 'v': 8000, 'w': 7505, 'x': 2125, 'z': 2058, 'j': 1950, 'q': 1536})"
        ]
       }
      ],
-     "prompt_number": 18
+     "prompt_number": 12
     },
     {
      "cell_type": "code",
        ]
       }
      ],
-     "prompt_number": 19
+     "prompt_number": 13
     },
     {
      "cell_type": "code",
        "output_type": "stream",
        "stream": "stdout",
        "text": [
-        "451\n"
+        "472\n"
        ]
       }
      ],
-     "prompt_number": 20
+     "prompt_number": 14
     },
     {
      "cell_type": "code",
      "language": "python",
      "metadata": {},
      "outputs": [],
-     "prompt_number": 33
+     "prompt_number": 15
     },
     {
      "cell_type": "code",
        "output_type": "stream",
        "stream": "stdout",
        "text": [
-        "485\n"
+        "452\n"
        ]
       }
      ],
-     "prompt_number": 34
+     "prompt_number": 16
     },
     {
      "cell_type": "code",
      "language": "python",
      "metadata": {},
      "outputs": [],
-     "prompt_number": 51
+     "prompt_number": 17
     },
     {
      "cell_type": "code",
        "output_type": "stream",
        "stream": "stdout",
        "text": [
-        "985\n"
+        "975\n"
        ]
       }
      ],
-     "prompt_number": 52
+     "prompt_number": 18
     },
     {
      "cell_type": "code",
      ],
      "prompt_number": 63
     },
-    {
-     "cell_type": "code",
-     "collapsed": false,
-     "input": [
-      "g.player.candidate_words"
-     ],
-     "language": "python",
-     "metadata": {},
-     "outputs": [
-      {
-       "metadata": {},
-       "output_type": "pyout",
-       "prompt_number": 59,
-       "text": [
-        "['a']"
-       ]
-      }
-     ],
-     "prompt_number": 59
-    },
-    {
-     "cell_type": "code",
-     "collapsed": false,
-     "input": [
-      "g.wrong_letters"
-     ],
-     "language": "python",
-     "metadata": {},
-     "outputs": [
-      {
-       "metadata": {},
-       "output_type": "pyout",
-       "prompt_number": 61,
-       "text": [
-        "['a']"
-       ]
-      }
-     ],
-     "prompt_number": 61
-    },
     {
      "cell_type": "code",
      "collapsed": false,
       "                self.ordered_letters = self.ordered_letters[:ri] + self.ordered_letters[ri+1:]\n",
       "    \n",
       "    def filter_candidate_words(self, discovered, missed):\n",
-      "        if missed:\n",
-      "            exclusion_pattern = '(?!.*[' + ''.join(missed) + '])'\n",
+      "        attempted_letters = list(set(l.lower() for l in discovered + missed if l in string.ascii_letters))\n",
+      "        if attempted_letters:\n",
+      "            exclusion_pattern = '[^' + ''.join(attempted_letters) + ']'\n",
       "        else:\n",
-      "            exclusion_pattern = ''\n",
-      "        exp = re.compile('^' + exclusion_pattern + ''.join(discovered).replace('_', '.') + '$')\n",
+      "            exclusion_pattern = '.'\n",
+      "        exp = re.compile('^' + ''.join(discovered).replace('_', exclusion_pattern) + '$')\n",
       "        self.candidate_words = [w for w in self.candidate_words if exp.match(w)]\n",
       "        \n",
       "    def set_ordered_letters(self):\n",
       "        counts = collections.Counter(l.lower() for l in ''.join(self.candidate_words) if l in string.ascii_letters)\n",
-      "        self.ordered_letters = [p[0] for p in counts.most_common()]"
-     ],
-     "language": "python",
-     "metadata": {},
-     "outputs": [],
-     "prompt_number": 109
-    },
-    {
-     "cell_type": "code",
-     "collapsed": false,
-     "input": [
-      "def fcw(words, discovered, missed):\n",
-      "    if missed:\n",
-      "        exclusion_pattern = '(?!.*[' + ''.join(missed) + '])'\n",
-      "    else:\n",
-      "        exclusion_pattern = ''\n",
-      "    exp = re.compile('^' + exclusion_pattern + ''.join(discovered).replace('_', '.') + '$')\n",
-      "    return [w for w in words if exp.match(w)]"
-     ],
-     "language": "python",
-     "metadata": {},
-     "outputs": [],
-     "prompt_number": 97
-    },
-    {
-     "cell_type": "code",
-     "collapsed": false,
-     "input": [
-      "def fcwp(discovered, missed):\n",
-      "    if missed:\n",
-      "        exclusion_pattern = '(?!.*[' + ''.join(missed) + '])'\n",
-      "    else:\n",
-      "        exclusion_pattern = ''\n",
-      "    return '^' + exclusion_pattern + ''.join(discovered).replace('_', '.') + '$'"
+      "        self.ordered_letters = [p[0] for p in counts.most_common()]\n"
      ],
      "language": "python",
      "metadata": {},
      "outputs": [],
-     "prompt_number": 102
-    },
-    {
-     "cell_type": "code",
-     "collapsed": false,
-     "input": [
-      "fcwp(['h', '_', 'p', '_'], ['x', 'w'])"
-     ],
-     "language": "python",
-     "metadata": {},
-     "outputs": [
-      {
-       "metadata": {},
-       "output_type": "pyout",
-       "prompt_number": 103,
-       "text": [
-        "'^(?!.*[xw])h.p.$'"
-       ]
-      }
-     ],
-     "prompt_number": 103
-    },
-    {
-     "cell_type": "code",
-     "collapsed": false,
-     "input": [
-      "re.match('^(?!.*[xw])h.p.$', 'hwpe')"
-     ],
-     "language": "python",
-     "metadata": {},
-     "outputs": [],
-     "prompt_number": 101
-    },
-    {
-     "cell_type": "code",
-     "collapsed": false,
-     "input": [
-      "re.match('^(?!.*[xw])h.p.$', 'hape')"
-     ],
-     "language": "python",
-     "metadata": {},
-     "outputs": [
-      {
-       "metadata": {},
-       "output_type": "pyout",
-       "prompt_number": 104,
-       "text": [
-        "<_sre.SRE_Match object; span=(0, 4), match='hape'>"
-       ]
-      }
-     ],
-     "prompt_number": 104
-    },
-    {
-     "cell_type": "code",
-     "collapsed": false,
-     "input": [
-      "fcw(WORDS, ['h', '_', 'p', '_'], ['x', 'w', 's'])"
-     ],
-     "language": "python",
-     "metadata": {},
-     "outputs": [
-      {
-       "metadata": {},
-       "output_type": "pyout",
-       "prompt_number": 108,
-       "text": [
-        "['hope', 'hype', 'hypo']"
-       ]
-      }
-     ],
-     "prompt_number": 108
+     "prompt_number": 25
     },
     {
      "cell_type": "code",
        "output_type": "stream",
        "stream": "stdout",
        "text": [
-        "992\n"
+        "995\n"
        ]
       }
      ],
-     "prompt_number": 110
-    },
-    {
-     "cell_type": "code",
-     "collapsed": false,
-     "input": [
-      "%%timeit\n",
-      "\n",
-      "wins = 0\n",
-      "for _ in range(1000):\n",
-      "    g = Game(random.choice(WORDS), player=PlayerAdaptiveIncludedLetters(WORDS))\n",
-      "    g.play_game()\n",
-      "    if g.game_won:\n",
-      "        wins += 1\n",
-      "print(wins)"
-     ],
-     "language": "python",
-     "metadata": {},
-     "outputs": [
-      {
-       "output_type": "stream",
-       "stream": "stdout",
-       "text": [
-        "984\n",
-        "979"
-       ]
-      },
-      {
-       "output_type": "stream",
-       "stream": "stdout",
-       "text": [
-        "\n",
-        "982"
-       ]
-      },
-      {
-       "output_type": "stream",
-       "stream": "stdout",
-       "text": [
-        "\n",
-        "979"
-       ]
-      },
-      {
-       "output_type": "stream",
-       "stream": "stdout",
-       "text": [
-        "\n",
-        "1 loops, best of 3: 52.9 s per loop\n"
-       ]
-      }
-     ],
-     "prompt_number": 111
+     "prompt_number": 27
     },
     {
      "cell_type": "code",
        "output_type": "stream",
        "stream": "stdout",
        "text": [
-        "986\n",
-        "991"
+        "992\n",
+        "994"
        ]
       },
       {
        "stream": "stdout",
        "text": [
         "\n",
-        "989"
+        "990"
        ]
       },
       {
        "stream": "stdout",
        "text": [
         "\n",
-        "1 loops, best of 3: 44.7 s per loop\n"
+        "1 loops, best of 3: 33.9 s per loop\n"
        ]
       }
      ],
-     "prompt_number": 112
+     "prompt_number": 28
     },
     {
      "cell_type": "code",
      "language": "python",
      "metadata": {},
      "outputs": [],
-     "prompt_number": 174
+     "prompt_number": 29
     },
     {
      "cell_type": "code",
      "language": "python",
      "metadata": {},
      "outputs": [],
-     "prompt_number": 175
+     "prompt_number": 30
     },
     {
      "cell_type": "code",
      "language": "python",
      "metadata": {},
      "outputs": [],
-     "prompt_number": 176
+     "prompt_number": 31
     },
     {
      "cell_type": "code",
      "language": "python",
      "metadata": {},
      "outputs": [],
-     "prompt_number": 177
-    },
-    {
-     "cell_type": "code",
-     "collapsed": false,
-     "input": [
-      "class PlayerAdaptivePatternNegLookahead(PlayerAdaptive):\n",
-      "    def filter_candidate_words(self, discovered, missed):\n",
-      "        if missed:\n",
-      "            exclusion_pattern = '(?!.*[' + ''.join(missed) + '])'\n",
-      "        else:\n",
-      "            exclusion_pattern = ''\n",
-      "        exp = re.compile('^' + exclusion_pattern + ''.join(discovered).replace('_', '.') + '$')\n",
-      "        self.candidate_words = [w for w in self.candidate_words if exp.match(w)]"
-     ],
-     "language": "python",
-     "metadata": {},
-     "outputs": [],
-     "prompt_number": 195
+     "prompt_number": 32
     },
     {
      "cell_type": "code",
      "language": "python",
      "metadata": {},
      "outputs": [],
-     "prompt_number": 196
+     "prompt_number": 33
     },
     {
      "cell_type": "code",
        "output_type": "stream",
        "stream": "stdout",
        "text": [
-        "453\n",
-        "494"
+        "465\n",
+        "458"
        ]
       },
       {
        "stream": "stdout",
        "text": [
         "\n",
-        "505"
+        "483"
        ]
       },
       {
        "stream": "stdout",
        "text": [
         "\n",
-        "477"
+        "482"
        ]
       },
       {
        "stream": "stdout",
        "text": [
         "\n",
-        "1 loops, best of 3: 24.3 s per loop\n"
+        "1 loops, best of 3: 18.5 s per loop\n"
        ]
       }
      ],
-     "prompt_number": 179
+     "prompt_number": 34
     },
     {
      "cell_type": "code",
        "output_type": "stream",
        "stream": "stdout",
        "text": [
-        "984\n",
+        "976\n",
         "983"
        ]
       },
        "stream": "stdout",
        "text": [
         "\n",
-        "985"
+        "983"
        ]
       },
       {
        "stream": "stdout",
        "text": [
         "\n",
-        "982"
+        "985"
        ]
       },
       {
        "stream": "stdout",
        "text": [
         "\n",
-        "1 loops, best of 3: 52.9 s per loop\n"
+        "1 loops, best of 3: 40.4 s per loop\n"
        ]
       }
      ],
-     "prompt_number": 180
+     "prompt_number": 35
     },
     {
      "cell_type": "code",
        "output_type": "stream",
        "stream": "stdout",
        "text": [
-        "535\n",
-        "509"
+        "513\n",
+        "507"
        ]
       },
       {
        "stream": "stdout",
        "text": [
         "\n",
-        "519"
+        "509"
        ]
       },
       {
        "stream": "stdout",
        "text": [
         "\n",
-        "507"
+        "523"
        ]
       },
       {
        "stream": "stdout",
        "text": [
         "\n",
-        "1 loops, best of 3: 11min 14s per loop\n"
+        "1 loops, best of 3: 8min 15s per loop\n"
        ]
       }
      ],
-     "prompt_number": 181
+     "prompt_number": 40
     },
     {
      "cell_type": "code",
        "output_type": "stream",
        "stream": "stdout",
        "text": [
-        "993\n",
-        "990"
+        "992\n",
+        "995"
        ]
       },
       {
        "stream": "stdout",
        "text": [
         "\n",
-        "992"
+        "998"
        ]
       },
       {
        "stream": "stdout",
        "text": [
         "\n",
-        "994"
+        "989"
        ]
       },
       {
        "stream": "stdout",
        "text": [
         "\n",
-        "1 loops, best of 3: 44.1 s per loop\n"
+        "1 loops, best of 3: 34.4 s per loop\n"
        ]
       }
      ],
-     "prompt_number": 197
+     "prompt_number": 41
     },
     {
      "cell_type": "code",
      "metadata": {},
      "outputs": [
       {
-       "output_type": "stream",
-       "stream": "stdout",
-       "text": [
-        "989\n",
-        "993"
-       ]
-      },
-      {
-       "output_type": "stream",
-       "stream": "stdout",
-       "text": [
-        "\n",
-        "994"
-       ]
-      },
-      {
-       "output_type": "stream",
-       "stream": "stdout",
-       "text": [
-        "\n",
-        "993"
-       ]
-      },
-      {
-       "output_type": "stream",
-       "stream": "stdout",
-       "text": [
-        "\n",
-        "1 loops, best of 3: 46 s per loop\n"
+       "ename": "NameError",
+       "evalue": "name 'PlayerAdaptivePatternNegLookahead' is not defined",
+       "output_type": "pyerr",
+       "traceback": [
+        "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[1;31mNameError\u001b[0m                                 Traceback (most recent call last)",
+        "\u001b[1;32m<ipython-input-42-850f0afb3e83>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mget_ipython\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mrun_cell_magic\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m'timeit'\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m''\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m'\\nwins = 0\\nfor _ in range(1000):\\n    g = Game(random.choice(WORDS), player=PlayerAdaptivePatternNegLookahead(WORDS))\\n    g.play_game()\\n    if g.game_won:\\n        wins += 1\\nprint(wins)'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m",
+        "\u001b[1;32m/usr/local/lib/python3.4/dist-packages/IPython/core/interactiveshell.py\u001b[0m in \u001b[0;36mrun_cell_magic\u001b[1;34m(self, magic_name, line, cell)\u001b[0m\n\u001b[0;32m   2160\u001b[0m             \u001b[0mmagic_arg_s\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mvar_expand\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mline\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mstack_depth\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m   2161\u001b[0m             \u001b[1;32mwith\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mbuiltin_trap\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m-> 2162\u001b[1;33m                 \u001b[0mresult\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mfn\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mmagic_arg_s\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mcell\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m   2163\u001b[0m             \u001b[1;32mreturn\u001b[0m \u001b[0mresult\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m   2164\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n",
+        "\u001b[1;32m/usr/local/lib/python3.4/dist-packages/IPython/core/magics/execution.py\u001b[0m in \u001b[0;36mtimeit\u001b[1;34m(self, line, cell)\u001b[0m\n",
+        "\u001b[1;32m/usr/local/lib/python3.4/dist-packages/IPython/core/magic.py\u001b[0m in \u001b[0;36m<lambda>\u001b[1;34m(f, *a, **k)\u001b[0m\n\u001b[0;32m    191\u001b[0m     \u001b[1;31m# but it's overkill for just that one bit of state.\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    192\u001b[0m     \u001b[1;32mdef\u001b[0m \u001b[0mmagic_deco\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0marg\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 193\u001b[1;33m         \u001b[0mcall\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;32mlambda\u001b[0m \u001b[0mf\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;33m*\u001b[0m\u001b[0ma\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;33m**\u001b[0m\u001b[0mk\u001b[0m\u001b[1;33m:\u001b[0m \u001b[0mf\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m*\u001b[0m\u001b[0ma\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;33m**\u001b[0m\u001b[0mk\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m    194\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    195\u001b[0m         \u001b[1;32mif\u001b[0m \u001b[0mcallable\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0marg\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
+        "\u001b[1;32m/usr/local/lib/python3.4/dist-packages/IPython/core/magics/execution.py\u001b[0m in \u001b[0;36mtimeit\u001b[1;34m(self, line, cell)\u001b[0m\n\u001b[0;32m   1011\u001b[0m             \u001b[0mnumber\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;36m1\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m   1012\u001b[0m             \u001b[1;32mfor\u001b[0m \u001b[0m_\u001b[0m \u001b[1;32min\u001b[0m \u001b[0mrange\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m1\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;36m10\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m-> 1013\u001b[1;33m                 \u001b[1;32mif\u001b[0m \u001b[0mtimer\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mtimeit\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mnumber\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;33m>=\u001b[0m \u001b[1;36m0.2\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m   1014\u001b[0m                     \u001b[1;32mbreak\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m   1015\u001b[0m                 \u001b[0mnumber\u001b[0m \u001b[1;33m*=\u001b[0m \u001b[1;36m10\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
+        "\u001b[1;32m/usr/lib/python3.4/timeit.py\u001b[0m in \u001b[0;36mtimeit\u001b[1;34m(self, number)\u001b[0m\n\u001b[0;32m    176\u001b[0m         \u001b[0mgc\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mdisable\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    177\u001b[0m         \u001b[1;32mtry\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 178\u001b[1;33m             \u001b[0mtiming\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0minner\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mit\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mtimer\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m    179\u001b[0m         \u001b[1;32mfinally\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    180\u001b[0m             \u001b[1;32mif\u001b[0m \u001b[0mgcold\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
+        "\u001b[1;32m<magic-timeit>\u001b[0m in \u001b[0;36minner\u001b[1;34m(_it, _timer)\u001b[0m\n",
+        "\u001b[1;31mNameError\u001b[0m: name 'PlayerAdaptivePatternNegLookahead' is not defined"
        ]
       }
      ],
-     "prompt_number": 198
+     "prompt_number": 42
     },
     {
      "cell_type": "code",
      ],
      "language": "python",
      "metadata": {},
-     "outputs": [
-      {
-       "output_type": "stream",
-       "stream": "stdout",
-       "text": [
-        "rutted ['_', 'u', 't', 't', 'e', 'd'] ['a', 'o', 'i', 'l', 's', 'g', 'b', 'j', 'n', 'p']\n",
-        "cur"
-       ]
-      },
-      {
-       "output_type": "stream",
-       "stream": "stdout",
-       "text": [
-        " ['_', 'u', '_'] ['a', 'o', 'e', 'i', 'b', 'g', 'n', 'm', 'p', 't']\n",
-        "wiles"
-       ]
-      },
-      {
-       "output_type": "stream",
-       "stream": "stdout",
-       "text": [
-        " ['_', 'i', '_', 'e', 's'] ['a', 'm', 'n', 'v', 't', 'r', 'k', 'f', 'p', 'd']\n",
-        "oak"
-       ]
-      },
-      {
-       "output_type": "stream",
-       "stream": "stdout",
-       "text": [
-        " ['_', 'a', '_'] ['t', 'p', 'g', 'w', 'd', 'y', 'r', 'm', 'b', 's']\n"
-       ]
-      }
-     ],
-     "prompt_number": 217
+     "outputs": []
     },
     {
      "cell_type": "code",