From: Neil Smith Date: Mon, 12 Jun 2017 08:35:12 +0000 (+0100) Subject: Updated text about sample problme X-Git-Url: https://git.njae.me.uk/?p=ou-summer-of-code-2017.git;a=commitdiff_plain;h=743e19357f7a93e3f7a7860bd174ddc5fe2610bc Updated text about sample problme --- diff --git a/04-word-search/wordsearch-solving.ipynb b/04-word-search/wordsearch-solving.ipynb index 86b1d9c..758380a 100644 --- a/04-word-search/wordsearch-solving.ipynb +++ b/04-word-search/wordsearch-solving.ipynb @@ -56,13 +56,19 @@ "\n", "Decoys: adapting bombing boor brick cackles carnal casino chaplets chump coaster coccyxes coddle collies creels crumbled cunt curds curled curlier deepen demeanor dicier dowses ensuing faddish fest fickler foaming gambol garoting gliding gristle grunts guts ibex impugns instants kielbasy lanyard loamier lugs market meanly minuend misprint mitts molested moonshot mucking oaks olives orgasmic pastrami perfect proceed puckered quashed refined regards retraces revel ridges ringlet scoff shinier siren solaria sprain sunder sunup tamped tapes thirds throw tiller times trains tranquil transfix typesets uric wariness welts whimsy winced winced\n", "\n", + "Decoys: fickler, adapting, chump, foaming, molested, carnal, crumbled, guts, minuend, bombing, winced, coccyxes, solaria, shinier, cackles\n", + "\n", + "All words: adapting, apace, bombing, cackles, carnal, chump, coccyxes, cowhides, crazies, crumbled, dock, fickler, foaming, guts, knows, lived, minuend, molested, mown, pears, probed, rhubarb, rioted, shinier, solaria, staple, tops, wide, winced\n", + "\n", "Directions: [('probed', '`(True, 3, 0, )`'), ('staple', '`(True, 9, 1, )`'), ('rioted', '`(True, 6, 7, )`'), ('cowhides', '`(True, 8, 3, )`'), ('tops', '`(True, 7, 4, )`'), ('knows', '`(True, 8, 2, )`'), ('lived', '`(True, 2, 4, )`'), ('rhubarb', '`(True, 2, 9, )`'), ('crazies', '`(True, 7, 1, )`'), ('dock', '`(True, 8, 5, )`'), ('apace', '`(True, 5, 8, )`'), ('mown', '`(True, 0, 5, )`'), ('pears', '`(True, 0, 3, )`'), ('wide', '`(True, 4, 4, )`')]" ] }, { "cell_type": "code", - "execution_count": 6, - "metadata": {}, + "execution_count": 4, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "import string\n", @@ -86,7 +92,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 5, "metadata": { "collapsed": true }, @@ -98,7 +104,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 6, "metadata": { "collapsed": true }, @@ -110,7 +116,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 7, "metadata": { "collapsed": true }, @@ -130,7 +136,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 8, "metadata": { "collapsed": true }, @@ -142,7 +148,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 9, "metadata": { "collapsed": true }, @@ -156,7 +162,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 10, "metadata": { "collapsed": true }, @@ -175,8 +181,10 @@ }, { "cell_type": "code", - "execution_count": 13, - "metadata": {}, + "execution_count": 11, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "def read_wordsearch(fn):\n", @@ -189,7 +197,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 12, "metadata": { "scrolled": true }, @@ -319,7 +327,7 @@ " 'zings'])" ] }, - "execution_count": 14, + "execution_count": 12, "metadata": {}, "output_type": "execute_result" } @@ -331,7 +339,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 13, "metadata": { "scrolled": true }, @@ -457,7 +465,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 14, "metadata": { "scrolled": true }, @@ -525,7 +533,7 @@ " 'zings']" ] }, - "execution_count": 16, + "execution_count": 14, "metadata": {}, "output_type": "execute_result" } @@ -543,7 +551,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 15, "metadata": {}, "outputs": [ { @@ -552,7 +560,7 @@ "'fortification'" ] }, - "execution_count": 17, + "execution_count": 15, "metadata": {}, "output_type": "execute_result" } @@ -570,7 +578,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 16, "metadata": {}, "outputs": [ { @@ -579,7 +587,7 @@ "'justification'" ] }, - "execution_count": 18, + "execution_count": 16, "metadata": {}, "output_type": "execute_result" } @@ -597,7 +605,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 17, "metadata": {}, "outputs": [ { @@ -606,7 +614,7 @@ "57" ] }, - "execution_count": 19, + "execution_count": 17, "metadata": {}, "output_type": "execute_result" } @@ -629,7 +637,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 18, "metadata": { "scrolled": true }, @@ -659,7 +667,7 @@ " 'z': 1})" ] }, - "execution_count": 20, + "execution_count": 18, "metadata": {}, "output_type": "execute_result" } @@ -673,7 +681,7 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": 19, "metadata": { "scrolled": true }, @@ -725,7 +733,7 @@ " 'wardrobes']" ] }, - "execution_count": 21, + "execution_count": 19, "metadata": {}, "output_type": "execute_result" } @@ -737,7 +745,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": 20, "metadata": { "scrolled": true }, @@ -746,48 +754,48 @@ "name": "stdout", "output_type": "stream", "text": [ - "ancestor Counter({'c': 1, 'a': 1, 't': 1, 's': 1, 'r': 1, 'n': 1, 'e': 1, 'o': 1})\n", - "baritone Counter({'a': 1, 'r': 1, 'i': 1, 'b': 1, 't': 1, 'e': 1, 'o': 1, 'n': 1})\n", - "bemusing Counter({'g': 1, 'i': 1, 's': 1, 'u': 1, 'b': 1, 'm': 1, 'n': 1, 'e': 1})\n", - "blonds Counter({'d': 1, 's': 1, 'b': 1, 'n': 1, 'l': 1, 'o': 1})\n", - "conciseness Counter({'s': 3, 'c': 2, 'n': 2, 'e': 2, 'i': 1, 'o': 1})\n", - "consequent Counter({'n': 2, 'e': 2, 'c': 1, 't': 1, 's': 1, 'u': 1, 'q': 1, 'o': 1})\n", - "cuddle Counter({'d': 2, 'c': 1, 'e': 1, 'l': 1, 'u': 1})\n", - "dashboards Counter({'a': 2, 's': 2, 'd': 2, 'r': 1, 'h': 1, 'b': 1, 'o': 1})\n", - "*despairing Counter({'i': 2, 'g': 1, 'a': 1, 'r': 1, 's': 1, 'p': 1, 'd': 1, 'e': 1, 'n': 1})\n", - "dint Counter({'d': 1, 'i': 1, 't': 1, 'n': 1})\n", - "employer Counter({'e': 2, 'r': 1, 'm': 1, 'p': 1, 'l': 1, 'y': 1, 'o': 1})\n", - "freakish Counter({'s': 1, 'a': 1, 'i': 1, 'r': 1, 'k': 1, 'h': 1, 'f': 1, 'e': 1})\n", + "ancestor Counter({'e': 1, 'a': 1, 's': 1, 'c': 1, 'n': 1, 'o': 1, 'r': 1, 't': 1})\n", + "baritone Counter({'i': 1, 'e': 1, 'a': 1, 'n': 1, 't': 1, 'o': 1, 'r': 1, 'b': 1})\n", + "bemusing Counter({'i': 1, 'e': 1, 's': 1, 'g': 1, 'n': 1, 'b': 1, 'u': 1, 'm': 1})\n", + "blonds Counter({'n': 1, 'l': 1, 's': 1, 'd': 1, 'o': 1, 'b': 1})\n", + "conciseness Counter({'s': 3, 'e': 2, 'n': 2, 'c': 2, 'i': 1, 'o': 1})\n", + "consequent Counter({'e': 2, 'n': 2, 'c': 1, 's': 1, 'q': 1, 'o': 1, 'u': 1, 't': 1})\n", + "cuddle Counter({'d': 2, 'l': 1, 'e': 1, 'u': 1, 'c': 1})\n", + "dashboards Counter({'a': 2, 's': 2, 'd': 2, 'o': 1, 'h': 1, 'r': 1, 'b': 1})\n", + "*despairing Counter({'i': 2, 'n': 1, 'e': 1, 'a': 1, 'p': 1, 'g': 1, 's': 1, 'd': 1, 'r': 1})\n", + "dint Counter({'i': 1, 'd': 1, 'n': 1, 't': 1})\n", + "employer Counter({'e': 2, 'p': 1, 'l': 1, 'y': 1, 'o': 1, 'm': 1, 'r': 1})\n", + "freakish Counter({'f': 1, 'i': 1, 'e': 1, 'a': 1, 's': 1, 'k': 1, 'h': 1, 'r': 1})\n", "*gall Counter({'l': 2, 'g': 1, 'a': 1})\n", - "hopelessness Counter({'s': 4, 'e': 3, 'h': 1, 'p': 1, 'n': 1, 'l': 1, 'o': 1})\n", - "*impales Counter({'s': 1, 'a': 1, 'm': 1, 'p': 1, 'i': 1, 'l': 1, 'e': 1})\n", - "infix Counter({'i': 2, 'f': 1, 'n': 1, 'x': 1})\n", - "inflow Counter({'i': 1, 'w': 1, 'l': 1, 'n': 1, 'f': 1, 'o': 1})\n", - "innumerable Counter({'n': 2, 'e': 2, 'a': 1, 'l': 1, 'r': 1, 'm': 1, 'u': 1, 'b': 1, 'i': 1})\n", - "intentional Counter({'n': 3, 't': 2, 'i': 2, 'a': 1, 'l': 1, 'e': 1, 'o': 1})\n", - "*jerkin Counter({'r': 1, 'i': 1, 'j': 1, 'n': 1, 'e': 1, 'k': 1})\n", - "justification Counter({'i': 3, 't': 2, 'c': 1, 'a': 1, 'j': 1, 's': 1, 'u': 1, 'f': 1, 'o': 1, 'n': 1})\n", - "leaving Counter({'g': 1, 'a': 1, 'v': 1, 'i': 1, 'l': 1, 'n': 1, 'e': 1})\n", - "locoweeds Counter({'e': 2, 'o': 2, 'c': 1, 's': 1, 'w': 1, 'l': 1, 'd': 1})\n", - "monickers Counter({'c': 1, 'r': 1, 'i': 1, 's': 1, 'm': 1, 'n': 1, 'e': 1, 'o': 1, 'k': 1})\n", - "originality Counter({'i': 3, 'g': 1, 'a': 1, 'r': 1, 't': 1, 'n': 1, 'l': 1, 'y': 1, 'o': 1})\n", - "outings Counter({'g': 1, 'n': 1, 'i': 1, 'u': 1, 's': 1, 't': 1, 'o': 1})\n", - "pendulous Counter({'u': 2, 'd': 1, 's': 1, 'p': 1, 'l': 1, 'n': 1, 'e': 1, 'o': 1})\n", - "pithier Counter({'i': 2, 'r': 1, 'h': 1, 'p': 1, 't': 1, 'e': 1})\n", - "randomness Counter({'s': 2, 'n': 2, 'a': 1, 'r': 1, 'm': 1, 'd': 1, 'e': 1, 'o': 1})\n", - "rectors Counter({'r': 2, 'c': 1, 's': 1, 't': 1, 'e': 1, 'o': 1})\n", - "redrew Counter({'r': 2, 'e': 2, 'd': 1, 'w': 1})\n", - "reformulated Counter({'r': 2, 'e': 2, 'a': 1, 'l': 1, 'm': 1, 'u': 1, 't': 1, 'f': 1, 'd': 1, 'o': 1})\n", - "remoteness Counter({'e': 3, 's': 2, 'r': 1, 'm': 1, 't': 1, 'o': 1, 'n': 1})\n", - "rethink Counter({'r': 1, 'i': 1, 'h': 1, 'k': 1, 't': 1, 'e': 1, 'n': 1})\n", - "scowls Counter({'s': 2, 'c': 1, 'l': 1, 'o': 1, 'w': 1})\n", - "sequencers Counter({'e': 3, 's': 2, 'c': 1, 'r': 1, 'u': 1, 'q': 1, 'n': 1})\n", - "serf Counter({'e': 1, 'f': 1, 'r': 1, 's': 1})\n", - "shook Counter({'o': 2, 'k': 1, 's': 1, 'h': 1})\n", - "spottiest Counter({'t': 3, 's': 2, 'i': 1, 'p': 1, 'e': 1, 'o': 1})\n", + "hopelessness Counter({'s': 4, 'e': 3, 'n': 1, 'p': 1, 'l': 1, 'h': 1, 'o': 1})\n", + "*impales Counter({'i': 1, 'e': 1, 'a': 1, 'p': 1, 'l': 1, 's': 1, 'm': 1})\n", + "infix Counter({'i': 2, 'f': 1, 'x': 1, 'n': 1})\n", + "inflow Counter({'f': 1, 'i': 1, 'n': 1, 'l': 1, 'w': 1, 'o': 1})\n", + "innumerable Counter({'e': 2, 'n': 2, 'i': 1, 'a': 1, 'l': 1, 'r': 1, 'b': 1, 'u': 1, 'm': 1})\n", + "intentional Counter({'n': 3, 'i': 2, 't': 2, 'e': 1, 'a': 1, 'l': 1, 'o': 1})\n", + "*jerkin Counter({'i': 1, 'e': 1, 'n': 1, 'k': 1, 'j': 1, 'r': 1})\n", + "justification Counter({'i': 3, 't': 2, 'f': 1, 'a': 1, 's': 1, 'c': 1, 'j': 1, 'o': 1, 'u': 1, 'n': 1})\n", + "leaving Counter({'g': 1, 'i': 1, 'e': 1, 'a': 1, 'n': 1, 'l': 1, 'v': 1})\n", + "locoweeds Counter({'e': 2, 'o': 2, 'w': 1, 'l': 1, 'c': 1, 's': 1, 'd': 1})\n", + "monickers Counter({'i': 1, 'e': 1, 'n': 1, 'c': 1, 's': 1, 'k': 1, 'o': 1, 'm': 1, 'r': 1})\n", + "originality Counter({'i': 3, 'a': 1, 'n': 1, 'l': 1, 'y': 1, 'g': 1, 't': 1, 'o': 1, 'r': 1})\n", + "outings Counter({'i': 1, 'n': 1, 's': 1, 'g': 1, 't': 1, 'o': 1, 'u': 1})\n", + "pendulous Counter({'u': 2, 'e': 1, 'n': 1, 'l': 1, 's': 1, 'p': 1, 'd': 1, 'o': 1})\n", + "pithier Counter({'i': 2, 'e': 1, 'p': 1, 't': 1, 'h': 1, 'r': 1})\n", + "randomness Counter({'n': 2, 's': 2, 'e': 1, 'a': 1, 'd': 1, 'o': 1, 'r': 1, 'm': 1})\n", + "rectors Counter({'r': 2, 'e': 1, 's': 1, 'c': 1, 't': 1, 'o': 1})\n", + "redrew Counter({'e': 2, 'r': 2, 'w': 1, 'd': 1})\n", + "reformulated Counter({'e': 2, 'r': 2, 'f': 1, 'a': 1, 'l': 1, 'u': 1, 't': 1, 'd': 1, 'o': 1, 'm': 1})\n", + "remoteness Counter({'e': 3, 's': 2, 'n': 1, 't': 1, 'o': 1, 'r': 1, 'm': 1})\n", + "rethink Counter({'i': 1, 'e': 1, 'n': 1, 'k': 1, 't': 1, 'h': 1, 'r': 1})\n", + "scowls Counter({'s': 2, 'o': 1, 'l': 1, 'w': 1, 'c': 1})\n", + "sequencers Counter({'e': 3, 's': 2, 'n': 1, 'q': 1, 'c': 1, 'u': 1, 'r': 1})\n", + "serf Counter({'f': 1, 'e': 1, 's': 1, 'r': 1})\n", + "shook Counter({'o': 2, 'h': 1, 's': 1, 'k': 1})\n", + "spottiest Counter({'t': 3, 's': 2, 'i': 1, 'e': 1, 'p': 1, 'o': 1})\n", "stood Counter({'o': 2, 't': 1, 's': 1, 'd': 1})\n", - "surtaxing Counter({'g': 1, 'a': 1, 'i': 1, 'r': 1, 's': 1, 'u': 1, 'x': 1, 't': 1, 'n': 1})\n", - "wardrobes Counter({'r': 2, 'a': 1, 'b': 1, 's': 1, 'w': 1, 'd': 1, 'e': 1, 'o': 1})\n" + "surtaxing Counter({'x': 1, 'i': 1, 'a': 1, 's': 1, 'g': 1, 't': 1, 'n': 1, 'u': 1, 'r': 1})\n", + "wardrobes Counter({'r': 2, 'e': 1, 'a': 1, 'w': 1, 's': 1, 'd': 1, 'o': 1, 'b': 1})\n" ] } ], @@ -803,7 +811,7 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": 21, "metadata": {}, "outputs": [ { @@ -812,7 +820,7 @@ "10" ] }, - "execution_count": 23, + "execution_count": 21, "metadata": {}, "output_type": "execute_result" } @@ -823,7 +831,7 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": 22, "metadata": {}, "outputs": [ { @@ -832,7 +840,7 @@ "'despairing'" ] }, - "execution_count": 24, + "execution_count": 22, "metadata": {}, "output_type": "execute_result" } @@ -843,8 +851,10 @@ }, { "cell_type": "code", - "execution_count": 25, - "metadata": {}, + "execution_count": 23, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "def do_wordsearch_tasks(fn, show_anyway=False):\n", @@ -881,7 +891,7 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": 24, "metadata": {}, "outputs": [ { @@ -904,7 +914,7 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": 25, "metadata": {}, "outputs": [ { @@ -927,7 +937,7 @@ }, { "cell_type": "code", - "execution_count": 28, + "execution_count": 26, "metadata": { "scrolled": true }, @@ -996,7 +1006,7 @@ }, { "cell_type": "code", - "execution_count": 29, + "execution_count": 27, "metadata": { "scrolled": true }, @@ -1123,7 +1133,7 @@ }, { "cell_type": "code", - "execution_count": 59, + "execution_count": 28, "metadata": { "collapsed": true }, @@ -1138,7 +1148,47 @@ }, { "cell_type": "code", - "execution_count": 41, + "execution_count": 29, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'fickler, adapting, chump, foaming, molested, carnal, crumbled, guts, minuend, bombing, winced, coccyxes, solaria, shinier, cackles'" + ] + }, + "execution_count": 29, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "', '.join(decoy_words)" + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'adapting, apace, bombing, cackles, carnal, chump, coccyxes, cowhides, crazies, crumbled, dock, fickler, foaming, guts, knows, lived, minuend, molested, mown, pears, probed, rhubarb, rioted, shinier, solaria, staple, tops, wide, winced'" + ] + }, + "execution_count": 30, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "', '.join(sorted(present_words + decoy_words))" + ] + }, + { + "cell_type": "code", + "execution_count": 31, "metadata": {}, "outputs": [ { @@ -1167,7 +1217,7 @@ "[(7, 5), (2, 3), (3, 5)]" ] }, - "execution_count": 41, + "execution_count": 31, "metadata": {}, "output_type": "execute_result" } @@ -1185,7 +1235,7 @@ }, { "cell_type": "code", - "execution_count": 42, + "execution_count": 32, "metadata": {}, "outputs": [ { @@ -1208,7 +1258,7 @@ }, { "cell_type": "code", - "execution_count": 45, + "execution_count": 33, "metadata": {}, "outputs": [ { @@ -1236,7 +1286,7 @@ }, { "cell_type": "code", - "execution_count": 63, + "execution_count": 34, "metadata": {}, "outputs": [ { @@ -1266,7 +1316,7 @@ }, { "cell_type": "code", - "execution_count": 54, + "execution_count": 35, "metadata": {}, "outputs": [ { @@ -1294,7 +1344,7 @@ }, { "cell_type": "code", - "execution_count": 64, + "execution_count": 36, "metadata": {}, "outputs": [ { @@ -1323,7 +1373,7 @@ }, { "cell_type": "code", - "execution_count": 65, + "execution_count": 42, "metadata": {}, "outputs": [ { @@ -1341,6 +1391,16 @@ ".i..h.npn.\n", "b......okr\n" ] + }, + { + "data": { + "text/plain": [ + "'aaabeffhhhiiijknnoppqqrsuvw'" + ] + }, + "execution_count": 42, + "metadata": {}, + "output_type": "execute_result" } ], "source": [ @@ -1348,7 +1408,8 @@ "for w in present_words:\n", " _, r, c, d = present(grid, w)\n", " set_grid(unused_grid, r, c, d, '.' * len(w))\n", - "print(show_grid(unused_grid))" + "print(show_grid(unused_grid))\n", + "cat(sorted(c for l in unused_grid for c in l if c in string.ascii_letters))" ] }, {