X-Git-Url: https://git.njae.me.uk/?a=blobdiff_plain;f=wordsearch%2Fwordsearch-creation.ipynb;h=8a81e740d1d85a109a7a6dd6ad45c2c4cf548056;hb=d86fa55df646b2374b032f3cc435cd4d8ddabf39;hp=03c8033c9631404c98bc1e9058c21c87bdcd5a60;hpb=e165b53b11a91729b43f87cabdd3054c62fd87d1;p=ou-summer-of-code-2017.git diff --git a/wordsearch/wordsearch-creation.ipynb b/wordsearch/wordsearch-creation.ipynb index 03c8033..8a81e74 100644 --- a/wordsearch/wordsearch-creation.ipynb +++ b/wordsearch/wordsearch-creation.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 2, + "execution_count": 65, "metadata": { "collapsed": false }, @@ -29,7 +29,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 66, "metadata": { "collapsed": false }, @@ -44,40 +44,32 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 67, "metadata": { "collapsed": false }, - "outputs": [ - { - "data": { - "text/plain": [ - "['aardvarks',\n", - " 'abaci',\n", - " 'abacuses',\n", - " 'abaft',\n", - " 'abalones',\n", - " 'abandoned',\n", - " 'abandoning',\n", - " 'abandonment',\n", - " 'abandons',\n", - " 'abased']" - ] - }, - "execution_count": 4, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], + "source": [ + "# ws_words = [w.strip() for w in open('wordsearch-words').readlines()\n", + "# if all(c in string.ascii_lowercase for c in w.strip())]\n", + "# ws_words[:10]" + ] + }, + { + "cell_type": "code", + "execution_count": 68, + "metadata": { + "collapsed": true + }, + "outputs": [], "source": [ - "ws_words = [w.strip() for w in open('wordsearch-words').readlines()\n", - " if all(c in string.ascii_lowercase for c in w.strip())]\n", - "ws_words[:10]" + "ws_words = [w.strip() for w in open('/usr/share/dict/british-english').readlines()\n", + " if all(c in string.ascii_lowercase for c in w.strip())]" ] }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 69, "metadata": { "collapsed": true }, @@ -89,7 +81,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 70, "metadata": { "collapsed": true }, @@ -101,7 +93,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 71, "metadata": { "collapsed": false }, @@ -130,7 +122,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 72, "metadata": { "collapsed": true }, @@ -150,7 +142,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 73, "metadata": { "collapsed": true }, @@ -162,7 +154,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 74, "metadata": { "collapsed": true }, @@ -176,7 +168,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 75, "metadata": { "collapsed": false }, @@ -205,7 +197,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 76, "metadata": { "collapsed": false }, @@ -216,7 +208,7 @@ "'..e.....'" ] }, - "execution_count": 12, + "execution_count": 76, "metadata": {}, "output_type": "execute_result" } @@ -227,7 +219,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 77, "metadata": { "collapsed": false }, @@ -238,7 +230,7 @@ "<_sre.SRE_Match object; span=(0, 4), match='keen'>" ] }, - "execution_count": 13, + "execution_count": 77, "metadata": {}, "output_type": "execute_result" } @@ -249,7 +241,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 78, "metadata": { "collapsed": false }, @@ -260,7 +252,7 @@ "<_sre.SRE_Match object; span=(0, 3), match='kee'>" ] }, - "execution_count": 14, + "execution_count": 78, "metadata": {}, "output_type": "execute_result" } @@ -271,7 +263,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 79, "metadata": { "collapsed": false }, @@ -282,7 +274,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 80, "metadata": { "collapsed": true }, @@ -293,7 +285,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 81, "metadata": { "collapsed": true }, @@ -306,7 +298,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 82, "metadata": { "collapsed": false }, @@ -317,7 +309,7 @@ "<_sre.SRE_Match object; span=(0, 4), match='keen'>" ] }, - "execution_count": 18, + "execution_count": 82, "metadata": {}, "output_type": "execute_result" } @@ -328,7 +320,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 83, "metadata": { "collapsed": false }, @@ -339,7 +331,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 84, "metadata": { "collapsed": false }, @@ -347,10 +339,10 @@ { "data": { "text/plain": [ - "" + "" ] }, - "execution_count": 20, + "execution_count": 84, "metadata": {}, "output_type": "execute_result" } @@ -361,13 +353,13 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": 129, "metadata": { "collapsed": true }, "outputs": [], "source": [ - "def fill_grid(grid, words, word_count, max_attempts= 1000):\n", + "def fill_grid(grid, words, word_count, max_attempts=10000):\n", " attempts = 0\n", " added_words = []\n", " w = len(grid[0])\n", @@ -378,7 +370,7 @@ " c = random.randrange(h)\n", " word = random.choice(words)\n", " d = random.choice(list(Direction))\n", - " if could_add(grid, r, c, d, word):\n", + " if len(word) >=4 and not any(word in w2 for w2 in added_words) and could_add(grid, r, c, d, word):\n", " set_grid(grid, r, c, d, word)\n", " added_words += [word]\n", " attempts = 0\n", @@ -387,7 +379,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": 86, "metadata": { "collapsed": false }, @@ -395,10 +387,10 @@ { "data": { "text/plain": [ - "35" + "40" ] }, - "execution_count": 22, + "execution_count": 86, "metadata": {}, "output_type": "execute_result" } @@ -411,7 +403,7 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": 87, "metadata": { "collapsed": false }, @@ -420,28 +412,28 @@ "name": "stdout", "output_type": "stream", "text": [ - "......swoopingg.l.up\n", - "..dunsnapped.n.i..ne\n", - ".cee.gninarci.m...er\n", - "sotpt......k.pmv..mv\n", - "euirca.d..c.n.a...pa\n", - "snduo.o.eo.e.lgs..ld\n", - "itndny.ctks.i.nos.oe\n", - "rroev.lsrsss..ifr.ys\n", - "eycno.eb.aeub.ttebas\n", - "tmetyr..asgetmuemebe\n", - "nerie....tvuu.dsraln\n", - "in.adbdmbecls.etocei\n", - "w..loeu.lilu..s.fh.d\n", - "...rtl.e.ec.l...eimw\n", - "..oac.d.v..y.e..rnao\n", - ".nrhgniknilsc.n..gyd\n", - ".pignippay...l.i..f.\n", - ".n..skcenrehtael..l.\n", - "g....popinjays.s..y.\n", - "gnimmugspuds.relppus\n", - "35 words added\n", - "ineluctably limpness countrymen slinking beaching restocking vellum convoyed winterises tusked leathernecks sugarcoated mayfly mulching popinjays magnitudes unsnapped prudential yapping spuds softest boron craning unemployable reformers bicycles swooping recondite dowdiness gumming pervades beveled valises suppler prated\n" + "l.fiestasrsnorffas..\n", + "a....s..e.a.cawing..\n", + "c..gt.dv.re.strongly\n", + "i..n..aecmbp....y...\n", + "m.eo.uthzoa.of..l.s.\n", + "od.lq.esozslhhlyo.k.\n", + "ns.e.r.se.ureanoh.r.\n", + "o.wby.t.aw.foin.u.u.\n", + "ca.o....i.a.to.d.rms\n", + "en..l...lerrs.d.i.sk\n", + "no...l..i.snalgarn.n\n", + "un....a.crappiest.gi\n", + ".y.....mdepraved..dw\n", + ".mgniggolricochet.ey\n", + ".o..pensivelyibmozil\n", + ".u.......curd.....fd\n", + ".sseitudlevehsid..id\n", + "...litchis..romut.ri\n", + ".understands......et\n", + "....nagilooh......v.\n", + "40 words added\n", + "understands crappiest archery mallows depraved cawing rawest curd tiny tiddlywinks fiestas zombi duties ricochet uneconomical hope litchis strongly verified logging handing anonymous quaver flours boost holy saffrons errs hooligan male belong tumor dishevel fuzzed raglans pensively murks dents cilia doors\n" ] } ], @@ -453,7 +445,7 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": 88, "metadata": { "collapsed": true }, @@ -472,7 +464,7 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": 89, "metadata": { "collapsed": false, "scrolled": true @@ -482,41 +474,46 @@ "name": "stdout", "output_type": "stream", "text": [ - "ineluctably (True, 16, 15, )\n", - "limpness (True, 0, 16, )\n", - "countrymen (True, 2, 1, )\n", - "slinking (True, 15, 11, )\n", - "beaching (True, 8, 17, )\n", - "restocking (True, 9, 5, )\n", - "vellum (True, 14, 8, )\n", - "convoyed (True, 4, 4, )\n", - "winterises (True, 12, 0, )\n", - "tusked (True, 9, 12, )\n", - "leathernecks (True, 17, 15, )\n", - "sugarcoated (True, 11, 12, )\n", - "mayfly (True, 13, 18, )\n", - "mulching (True, 11, 7, )\n", - "popinjays (True, 18, 5, )\n", - "magnitudes (True, 3, 14, )\n", - "unsnapped (True, 1, 3, )\n", - "prudential (True, 3, 3, )\n", - "yapping (True, 16, 9, )\n", - "spuds (True, 19, 7, )\n", - "softest (True, 5, 15, )\n", - "boron (True, 11, 5, )\n", - "craning (True, 2, 11, )\n", - "unemployable (True, 0, 18, )\n", - "reformers (True, 14, 16, )\n", - "bicycles (True, 11, 8, )\n", - "swooping (True, 0, 6, )\n", - "recondite (True, 10, 2, )\n", - "dowdiness (True, 15, 19, )\n", - "gumming (True, 19, 6, )\n", - "pervades (True, 0, 19, )\n", - "beveled (True, 8, 12, )\n", - "valises (True, 3, 15, )\n", - "suppler (True, 19, 19, )\n", - "prated (True, 16, 1, )\n" + "understands (True, 18, 1, )\n", + "crappiest (True, 11, 8, )\n", + "archery (True, 1, 10, )\n", + "mallows (True, 12, 7, )\n", + "depraved (True, 12, 8, )\n", + "cawing (True, 1, 12, )\n", + "rawest (True, 9, 11, )\n", + "curd (True, 15, 9, )\n", + "tiny (True, 8, 12, )\n", + "tiddlywinks (True, 18, 19, )\n", + "fiestas (True, 0, 2, )\n", + "zombi (True, 14, 17, )\n", + "duties (True, 16, 7, )\n", + "ricochet (True, 13, 9, )\n", + "uneconomical (True, 11, 0, )\n", + "hope (True, 5, 13, )\n", + "litchis (True, 17, 3, )\n", + "strongly (True, 2, 12, )\n", + "verified (True, 19, 18, )\n", + "logging (True, 13, 8, )\n", + "handing (True, 5, 12, )\n", + "anonymous (True, 8, 1, )\n", + "quaver (True, 5, 4, )\n", + "flours (True, 4, 13, )\n", + "boost (True, 3, 10, )\n", + "holy (True, 6, 16, )\n", + "saffrons (True, 0, 17, )\n", + "errs (True, 9, 9, )\n", + "hooligan (True, 19, 11, )\n", + "male (True, 3, 9, )\n", + "belong (True, 7, 3, )\n", + "tumor (True, 17, 16, )\n", + "dishevel (True, 16, 15, )\n", + "fuzzed (True, 7, 11, )\n", + "raglans (True, 10, 16, )\n", + "pensively (True, 14, 4, )\n", + "murks (True, 8, 18, )\n", + "dents (True, 5, 1, )\n", + "cilia (True, 11, 8, )\n", + "doors (True, 9, 14, )\n" ] } ], @@ -527,7 +524,7 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": 125, "metadata": { "collapsed": true }, @@ -535,12 +532,12 @@ "source": [ "def interesting(grid, words):\n", " dirs = set(present(grid, w)[3] for w in words)\n", - " return len(words) > 35 and len(words) < 40 and len(dirs) + 1 >= len(delta)" + " return len(words) > 40 and len(dirs) + 1 >= len(delta)" ] }, { "cell_type": "code", - "execution_count": 27, + "execution_count": 126, "metadata": { "collapsed": false }, @@ -551,7 +548,7 @@ "False" ] }, - "execution_count": 27, + "execution_count": 126, "metadata": {}, "output_type": "execute_result" } @@ -562,7 +559,7 @@ }, { "cell_type": "code", - "execution_count": 28, + "execution_count": 131, "metadata": { "collapsed": true }, @@ -572,14 +569,14 @@ " boring = True\n", " while boring:\n", " grid = empty_grid(20, 20)\n", - " grid, words = fill_grid(grid, ws_words, 40)\n", + " grid, words = fill_grid(grid, ws_words, 80)\n", " boring = not interesting(grid, words)\n", " return grid, words" ] }, { "cell_type": "code", - "execution_count": 29, + "execution_count": 132, "metadata": { "collapsed": false }, @@ -588,28 +585,28 @@ "name": "stdout", "output_type": "stream", "text": [ - "..reittonk..ss......\n", - "tinctured.wcee.....w\n", - "serutats.oyozm....o.\n", - "b....s..l.eoia...m.r\n", - "e.b.y.lf..lpsd..bgye\n", - "a.ist.no..less.ssrgm\n", - "m.gtfi.lo.orae.n.ura\n", - "edaei..i.cwi.mo..mor\n", - "demrn..b..in.m...psk\n", - "epya...e..sgm....ile\n", - "slsg...l..hi.....nrd\n", - "tekisyassesdepeebeum\n", - "rtec.gninretni...sfo\n", - "oiinsetse..baggy.snd\n", - "ynn....p..sebircsaui\n", - "egs.noitasiretupmocf\n", - "r.....artefacts....y\n", - "s.....seilaog.winosi\n", - ".....eyelidsegener.n\n", - "regicidesesopatxuj.g\n", - "38 words added; 7 directions\n", - "wombs persimmons computerisation ascribes coopering goalies beamed modifying insets cigarets statures libels remarked baggy juxtaposes mesdames grumpiness artefacts skeins assizes inflow depleting beeped reneges interning yellowish regicides eyelids cools orgy nifty knottier destroyers unfurls tinctured bigamy winos essays\n" + "....gnixof...keem...\n", + "feihc.spollawvase..s\n", + "p.h.shs..snetsafnun.\n", + "aeiy.adt..plehdowned\n", + "rmcfmzhennaturali.h.\n", + "abkake.pteebyelawsay\n", + "dlcweln.lnmvrdrawllr\n", + "ealnes.s.aeeieslaroe\n", + ".zaelreffidclwl...gs\n", + ".omtisadeelbst.bg.ei\n", + ".noantr...tunet.o.nm\n", + "serigamchamoixbemnsb\n", + "sd.tnuu..lleterls..e\n", + "e.dounf..dekcalsu..s\n", + "gyegtcfknobetatser.t\n", + "rlkeshskcelf..ploptr\n", + "alon.l..sriahdawnsgi\n", + "lac..y..gnittilps.od\n", + ".eyeball..denedragse\n", + ".r..ygnamsecstirg.hs\n", + "57 words added; 7 directions\n", + "chamoix staunchly keeling wive inns restate settlements byelaws blurt help foxing flecks orals differ unfastens mangy hymens wallops negotiate bestrides largess dawns nobler chief eyeball splitting bleed halogens clamor parade emblazoned hairs meek earmuff slacked retell scented gardened natural grits misery drawl gosh smog stung coked knob tune really secs plop alphas vase downed hazels hick fawn\n" ] } ], @@ -622,7 +619,7 @@ }, { "cell_type": "code", - "execution_count": 30, + "execution_count": 94, "metadata": { "collapsed": true }, @@ -639,7 +636,7 @@ }, { "cell_type": "code", - "execution_count": 31, + "execution_count": 95, "metadata": { "collapsed": true }, @@ -664,7 +661,7 @@ }, { "cell_type": "code", - "execution_count": 32, + "execution_count": 96, "metadata": { "collapsed": false }, @@ -676,7 +673,7 @@ }, { "cell_type": "code", - "execution_count": 34, + "execution_count": 97, "metadata": { "collapsed": false }, @@ -688,7 +685,18 @@ }, { "cell_type": "code", - "execution_count": 35, + "execution_count": 118, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "normalised_wordsearch_counts = normalise(collections.Counter(normalised_wordsearch_counts) + collections.Counter({l: 0.05 for l in string.ascii_lowercase}))" + ] + }, + { + "cell_type": "code", + "execution_count": 98, "metadata": { "collapsed": true }, @@ -718,7 +726,7 @@ }, { "cell_type": "code", - "execution_count": 36, + "execution_count": 99, "metadata": { "collapsed": false }, @@ -726,10 +734,10 @@ { "data": { "text/plain": [ - "'aaaaaaaabcccddddeeeeeeeeeeeeeeefffggghhhhhiiiiiillllmnnnnnnoooooooooprrsssssssssssssttttttttuuuvwwwy'" + "'aaaaaaaaaabcdddeeeeeeeeeeeefffffgghhhhhhhhhiiiiiiikllmnnnnnnnooooooooprrrrssssssssssssttttttuuvwwwww'" ] }, - "execution_count": 36, + "execution_count": 99, "metadata": {}, "output_type": "execute_result" } @@ -740,7 +748,7 @@ }, { "cell_type": "code", - "execution_count": 37, + "execution_count": 100, "metadata": { "collapsed": false }, @@ -748,10 +756,10 @@ { "data": { "text/plain": [ - "'aaaaaabcccddddddeeeeeeggggghhiiiiiiiiiiiiklllmmmmnnnnnnnnnnoooooooooppprrrrrrrrrssssssttttttuuuwwwyy'" + "'aaaaaaccccdddeeeeeeeeeeeeeeeeeeeffgghhiiiiikkklllmmmnnnnnnooooooppprrrrrrrrssssssssttttttuuuuuuvwyyy'" ] }, - "execution_count": 37, + "execution_count": 100, "metadata": {}, "output_type": "execute_result" } @@ -762,7 +770,7 @@ }, { "cell_type": "code", - "execution_count": 38, + "execution_count": 101, "metadata": { "collapsed": false }, @@ -770,10 +778,10 @@ { "data": { "text/plain": [ - "'a'" + "'e'" ] }, - "execution_count": 38, + "execution_count": 101, "metadata": {}, "output_type": "execute_result" } @@ -784,7 +792,7 @@ }, { "cell_type": "code", - "execution_count": 39, + "execution_count": 102, "metadata": { "collapsed": true }, @@ -803,7 +811,7 @@ }, { "cell_type": "code", - "execution_count": 40, + "execution_count": 103, "metadata": { "collapsed": false }, @@ -812,26 +820,26 @@ "name": "stdout", "output_type": "stream", "text": [ - "streittonkorsssatnal\n", - "tincturedswceedrlnuw\n", - "serutatsloyozmeieiot\n", - "baanfsollleoiasnlmar\n", - "ewblyhlfetlpsdyvbgye\n", - "aeistonoeilessassrgm\n", - "mlgtfitloioraeenwura\n", - "edaeiupiscwiamoygmor\n", - "demrnasbhcinsmiiapsk\n", - "epyakraedrsgmolsnile\n", - "slsgtuoloihireneonrd\n", - "tekisyassesdepeebeum\n", - "rtecigninretnincesfo\n", - "oiinsetseddbaggydsnd\n", - "ynnnsfapcfsebircsaui\n", - "egsonoitasiretupmocf\n", - "raioelartefactseawfy\n", - "speonsseilaogrwinosi\n", - "wrndfeyelidsegenerln\n", - "regicidesesopatxujrg\n" + "nwtautoimmuneeyinsdl\n", + "majorlyerasescmcider\n", + "edthrallednxlcawoeaa\n", + "gnizeensbnahwwgpsksr\n", + "rmisrksiosgiitndtaep\n", + "rioigoeopeglbnegsesu\n", + "esurnrbdifecihtniust\n", + "eeauuieimddlgiiigqan\n", + "srcplooscrlufestosve\n", + "pdcasmhemaonrgialcel\n", + "lguvrepkcrekennronru\n", + "ensesmtiesrtiogocwcr\n", + "niadpnetulasgpdfeesi\n", + "dgthgreoonavhsorinyv\n", + "inilpehmnrnntuaeeoae\n", + "dioesnmnocstennpolcm\n", + "etniwvredwtidnmfdshm\n", + "sgsoaarunyyoslurstts\n", + "tetoyisimdmaderetlaf\n", + "ettflightasnlclquasi\n" ] } ], @@ -842,7 +850,7 @@ }, { "cell_type": "code", - "execution_count": 41, + "execution_count": 104, "metadata": { "collapsed": false }, @@ -851,26 +859,26 @@ "name": "stdout", "output_type": "stream", "text": [ - "..reittonk..ss......\n", - "tinctured.wcee.....w\n", - "serutats.oyozm....o.\n", - "b....s..l.eoia...m.r\n", - "e.b.y.lf..lpsd..bgye\n", - "a.ist.no..less.ssrgm\n", - "m.gtfi.lo.orae.n.ura\n", - "edaei..i.cwi.mo..mor\n", - "demrn..b..in.m...psk\n", - "epya...e..sgm....ile\n", - "slsg...l..hi.....nrd\n", - "tekisyassesdepeebeum\n", - "rtec.gninretni...sfo\n", - "oiinsetse..baggy.snd\n", - "ynn....p..sebircsaui\n", - "egs.noitasiretupmocf\n", - "r.....artefacts....y\n", - "s.....seilaog.winosi\n", - ".....eyelidsegener.n\n", - "regicidesesopatxuj.g\n" + "...autoimmune.......\n", + "majorlyerases.m..d..\n", + "..thralledn...a..e..\n", + "gnizeens..a..wg.sk..\n", + ".m.s..si..g.i.ndtae.\n", + ".i.ig.eo..gl..egses.\n", + ".s.rnrbd..ec.htniust\n", + ".eauuiei.ddlg.iigqan\n", + "srcploos..lufestosve\n", + "p.casmhe.aonrgial.el\n", + "lguv.ep.crekennro.ru\n", + "ense.m.i.s..iogoc.cr\n", + "niad.netulasgp.fee.i\n", + "dgt..reo....hs.r.nyv\n", + "ini..ehm....t.ae.oa.\n", + "dio..nm.o...en.p.lc.\n", + "etn.w..e.w..d.....h.\n", + "s.so....n.yoslurs.t.\n", + "t.t......dmaderetlaf\n", + "...flight.s.l..quasi\n" ] } ], @@ -880,7 +888,7 @@ }, { "cell_type": "code", - "execution_count": 42, + "execution_count": 105, "metadata": { "collapsed": false, "scrolled": true @@ -890,44 +898,45 @@ "name": "stdout", "output_type": "stream", "text": [ - "wombs (True, 1, 19, )\n", - "persimmons (True, 14, 7, )\n", - "computerisation (True, 15, 18, )\n", - "ascribes (True, 14, 17, )\n", - "coopering (True, 1, 11, )\n", - "goalies (True, 17, 12, )\n", - "beamed (True, 3, 0, )\n", - "modifying (True, 11, 19, )\n", - "insets (True, 13, 2, )\n", - "cigarets (True, 12, 3, )\n", - "statures (True, 2, 7, )\n", - "libels (True, 6, 7, )\n", - "remarked (True, 3, 19, )\n", - "baggy (True, 13, 11, )\n", - "juxtaposes (True, 19, 17, )\n", - "mesdames (True, 7, 13, )\n", - "grumpiness (True, 4, 17, )\n", - "artefacts (True, 16, 6, )\n", - "skeins (True, 10, 2, )\n", - "assizes (True, 6, 12, )\n", - "inflow (True, 6, 5, )\n", - "depleting (True, 7, 1, )\n", - "beeped (True, 11, 16, )\n", - "reneges (True, 18, 17, )\n", - "interning (True, 12, 13, )\n", - "yellowish (True, 2, 10, )\n", - "regicides (True, 19, 0, )\n", - "eyelids (True, 18, 5, )\n", - "cools (True, 7, 9, )\n", - "orgy (True, 7, 18, )\n", - "nifty (True, 8, 4, )\n", - "knottier (True, 0, 9, )\n", - "destroyers (True, 8, 0, )\n", - "unfurls (True, 14, 18, )\n", - "tinctured (True, 1, 0, )\n", - "bigamy (True, 4, 2, )\n", - "winos (True, 17, 14, )\n", - "essays (True, 11, 9, )\n" + "thralled (True, 2, 2, )\n", + "slung (True, 9, 4, )\n", + "freighted (True, 8, 12, )\n", + "townhouse (True, 18, 2, )\n", + "salute (True, 12, 11, )\n", + "phoebes (True, 10, 6, )\n", + "faltered (True, 18, 19, )\n", + "laywomen (True, 19, 12, )\n", + "squeaked (True, 8, 17, )\n", + "perforating (True, 15, 15, )\n", + "iodise (True, 4, 7, )\n", + "lacier (True, 8, 10, )\n", + "autoimmune (True, 0, 3, )\n", + "tinging (True, 16, 1, )\n", + "snagged (True, 1, 10, )\n", + "splendidest (True, 8, 0, )\n", + "roughed (True, 10, 9, )\n", + "crevasse (True, 11, 18, )\n", + "lone (True, 15, 17, )\n", + "ecologists (True, 12, 16, )\n", + "sponge (True, 13, 13, )\n", + "magnetising (True, 1, 14, )\n", + "sneezing (True, 3, 7, )\n", + "virulent (True, 13, 19, )\n", + "flight (True, 19, 3, )\n", + "sirup (True, 4, 3, )\n", + "yacht (True, 13, 18, )\n", + "random (True, 13, 15, )\n", + "accusations (True, 7, 2, )\n", + "wiled (True, 3, 13, )\n", + "paved (True, 8, 3, )\n", + "majorly (True, 1, 0, )\n", + "miser (True, 4, 1, )\n", + "memoir (True, 11, 5, )\n", + "emends (True, 14, 5, )\n", + "slurs (True, 17, 12, )\n", + "clunk (True, 6, 11, )\n", + "erases (True, 1, 7, )\n", + "quasi (True, 19, 15, )\n" ] } ], @@ -938,24 +947,25 @@ }, { "cell_type": "code", - "execution_count": 43, + "execution_count": 141, "metadata": { - "collapsed": true + "collapsed": false }, "outputs": [], "source": [ - "def decoys(grid, words, all_words, limit=60):\n", + "def decoys(grid, words, all_words, limit=100):\n", " decoy_words = []\n", + " dlen_limit = max(len(w) for w in words)\n", " while len(words) + len(decoy_words) < limit:\n", " d = random.choice(all_words)\n", - " if d not in words and not present(grid, d)[0]:\n", + " if d not in words and len(d) >= 4 and len(d) <= dlen_limit and not present(grid, d)[0]:\n", " decoy_words += [d]\n", " return decoy_words" ] }, { "cell_type": "code", - "execution_count": 45, + "execution_count": 135, "metadata": { "collapsed": false }, @@ -963,31 +973,53 @@ { "data": { "text/plain": [ - "['blindfolding',\n", - " 'televised',\n", - " 'climaxed',\n", - " 'autumns',\n", - " 'aquaria',\n", - " 'bilks',\n", - " 'psychologies',\n", - " 'sparkled',\n", - " 'dorkiest',\n", - " 'corollas',\n", - " 'polygons',\n", - " 'accessioning',\n", - " 'bubbled',\n", - " 'astringency',\n", - " 'debunking',\n", - " 'cannery',\n", - " 'exhilarates',\n", - " 'overzealous',\n", - " 'primping',\n", - " 'geckos',\n", - " 'admiration',\n", - " 'misconstructions']" + "['incisor',\n", + " 'steeled',\n", + " 'immobility',\n", + " 'undertakings',\n", + " 'exhorts',\n", + " 'hairnet',\n", + " 'placarded',\n", + " 'sackful',\n", + " 'covenanting',\n", + " 'invoking',\n", + " 'deltas',\n", + " 'nonplus',\n", + " 'exactest',\n", + " 'eggs',\n", + " 'tercentenary',\n", + " 'angelic',\n", + " 'relearning',\n", + " 'ardors',\n", + " 'imprints',\n", + " 'chamoix',\n", + " 'governance',\n", + " 'rampart',\n", + " 'estuary',\n", + " 'poltroons',\n", + " 'expect',\n", + " 'restaurant',\n", + " 'ashrams',\n", + " 'illuminates',\n", + " 'reprises',\n", + " 'seismology',\n", + " 'announce',\n", + " 'tomorrows',\n", + " 'carcinogenics',\n", + " 'duplex',\n", + " 'transmitters',\n", + " 'prosier',\n", + " 'anther',\n", + " 'masticates',\n", + " 'raunchy',\n", + " 'briefs',\n", + " 'poniard',\n", + " 'daunted',\n", + " 'topmasts',\n", + " 'mynas']" ] }, - "execution_count": 45, + "execution_count": 135, "metadata": {}, "output_type": "execute_result" } @@ -999,7 +1031,7 @@ }, { "cell_type": "code", - "execution_count": 46, + "execution_count": 108, "metadata": { "collapsed": false, "scrolled": true @@ -1009,66 +1041,66 @@ "name": "stdout", "output_type": "stream", "text": [ - "wombs (True, 1, 19, )\n", - "persimmons (True, 14, 7, )\n", - "computerisation (True, 15, 18, )\n", - "ascribes (True, 14, 17, )\n", - "coopering (True, 1, 11, )\n", - "goalies (True, 17, 12, )\n", - "beamed (True, 3, 0, )\n", - "modifying (True, 11, 19, )\n", - "insets (True, 13, 2, )\n", - "cigarets (True, 12, 3, )\n", - "statures (True, 2, 7, )\n", - "libels (True, 6, 7, )\n", - "remarked (True, 3, 19, )\n", - "baggy (True, 13, 11, )\n", - "juxtaposes (True, 19, 17, )\n", - "mesdames (True, 7, 13, )\n", - "grumpiness (True, 4, 17, )\n", - "artefacts (True, 16, 6, )\n", - "skeins (True, 10, 2, )\n", - "assizes (True, 6, 12, )\n", - "inflow (True, 6, 5, )\n", - "depleting (True, 7, 1, )\n", - "beeped (True, 11, 16, )\n", - "reneges (True, 18, 17, )\n", - "interning (True, 12, 13, )\n", - "yellowish (True, 2, 10, )\n", - "regicides (True, 19, 0, )\n", - "eyelids (True, 18, 5, )\n", - "cools (True, 7, 9, )\n", - "orgy (True, 7, 18, )\n", - "nifty (True, 8, 4, )\n", - "knottier (True, 0, 9, )\n", - "destroyers (True, 8, 0, )\n", - "unfurls (True, 14, 18, )\n", - "tinctured (True, 1, 0, )\n", - "bigamy (True, 4, 2, )\n", - "winos (True, 17, 14, )\n", - "essays (True, 11, 9, )\n", - "blindfolding (False, 0, 0, )\n", - "televised (False, 0, 0, )\n", - "climaxed (False, 0, 0, )\n", - "autumns (False, 0, 0, )\n", - "aquaria (False, 0, 0, )\n", - "bilks (False, 0, 0, )\n", - "psychologies (False, 0, 0, )\n", - "sparkled (False, 0, 0, )\n", - "dorkiest (False, 0, 0, )\n", - "corollas (False, 0, 0, )\n", - "polygons (False, 0, 0, )\n", - "accessioning (False, 0, 0, )\n", - "bubbled (False, 0, 0, )\n", - "astringency (False, 0, 0, )\n", - "debunking (False, 0, 0, )\n", - "cannery (False, 0, 0, )\n", - "exhilarates (False, 0, 0, )\n", - "overzealous (False, 0, 0, )\n", - "primping (False, 0, 0, )\n", - "geckos (False, 0, 0, )\n", - "admiration (False, 0, 0, )\n", - "misconstructions (False, 0, 0, )\n" + "thralled (True, 2, 2, )\n", + "slung (True, 9, 4, )\n", + "freighted (True, 8, 12, )\n", + "townhouse (True, 18, 2, )\n", + "salute (True, 12, 11, )\n", + "phoebes (True, 10, 6, )\n", + "faltered (True, 18, 19, )\n", + "laywomen (True, 19, 12, )\n", + "squeaked (True, 8, 17, )\n", + "perforating (True, 15, 15, )\n", + "iodise (True, 4, 7, )\n", + "lacier (True, 8, 10, )\n", + "autoimmune (True, 0, 3, )\n", + "tinging (True, 16, 1, )\n", + "snagged (True, 1, 10, )\n", + "splendidest (True, 8, 0, )\n", + "roughed (True, 10, 9, )\n", + "crevasse (True, 11, 18, )\n", + "lone (True, 15, 17, )\n", + "ecologists (True, 12, 16, )\n", + "sponge (True, 13, 13, )\n", + "magnetising (True, 1, 14, )\n", + "sneezing (True, 3, 7, )\n", + "virulent (True, 13, 19, )\n", + "flight (True, 19, 3, )\n", + "sirup (True, 4, 3, )\n", + "yacht (True, 13, 18, )\n", + "random (True, 13, 15, )\n", + "accusations (True, 7, 2, )\n", + "wiled (True, 3, 13, )\n", + "paved (True, 8, 3, )\n", + "majorly (True, 1, 0, )\n", + "miser (True, 4, 1, )\n", + "memoir (True, 11, 5, )\n", + "emends (True, 14, 5, )\n", + "slurs (True, 17, 12, )\n", + "clunk (True, 6, 11, )\n", + "erases (True, 1, 7, )\n", + "quasi (True, 19, 15, )\n", + "leakiest (False, 0, 0, )\n", + "lumpiest (False, 0, 0, )\n", + "bastion (False, 0, 0, )\n", + "steamier (False, 0, 0, )\n", + "elegant (False, 0, 0, )\n", + "slogging (False, 0, 0, )\n", + "rejects (False, 0, 0, )\n", + "gaze (False, 0, 0, )\n", + "swopping (False, 0, 0, )\n", + "resonances (False, 0, 0, )\n", + "treasonous (False, 0, 0, )\n", + "corm (False, 0, 0, )\n", + "abuses (False, 0, 0, )\n", + "toga (False, 0, 0, )\n", + "upcountry (False, 0, 0, )\n", + "scrawled (False, 0, 0, )\n", + "cellar (False, 0, 0, )\n", + "skinflint (False, 0, 0, )\n", + "wasteland (False, 0, 0, )\n", + "madman (False, 0, 0, )\n", + "lash (False, 0, 0, )\n" ] } ], @@ -1079,7 +1111,7 @@ }, { "cell_type": "code", - "execution_count": 47, + "execution_count": 142, "metadata": { "collapsed": false }, @@ -1088,29 +1120,49 @@ "name": "stdout", "output_type": "stream", "text": [ - "tuiababblerssknalbft\n", - "gnewerodeswskrowerif\n", - "nballooningosfriedum\n", - "iuebksidesaddlessldt\n", - "mrncdbmnnyllasuaceet\n", - "udiesnettirwtsohglli\n", - "uepoeyremeenoyreveum\n", - "cnuselitnegfatterbdp\n", - "asslmulleveiadieneer\n", - "visnmewsrelrsbtleddi\n", - "crouchinghogetrzooms\n", - "dstrihstaewseteaotoo\n", - "vkssrdovulatesrldgon\n", - "snnvengefullyuiawets\n", - "uiofendelleuferrcosi\n", - "ahsdenoixelpmocluitt\n", - "vcdauthorisesnfsnenp\n", - "eyoelmferociouslypng\n", - "lngimmpauperisedtnon\n", - "ytnthstnemecitnehhpc\n", - "38 words added; 7 directions\n", - "Present: abrades authorises babblers ballooning blanks causally chinks complexioned crouching deluded emery enticements erodes everyone fatter ferociously fireworks fried gentiles ghostwritten godsons imprisons mews ovulates owlets pauperised refuelled retracing sidesaddles suavely supine sweatshirts unburdens vacuuming vellum vengefully yeti zooms\n", - "Decoys: chastened doodling ethnologists executrixes freelancing generously halfheartedness harries kinswoman mangles narrowly optimising oversimplifies polystyrene recounts riffing slicking smackers squashy thirsting tiebreakers unexampled\n" + ".strigger.essegassum\n", + "acselacs.tapri..pgcr\n", + "moeclienterr.em.uaie\n", + "apisearsclmo.kvpmntp\n", + "lebpg..ohlucfaeaespe\n", + "ifbi.ev.aafeesr.urol\n", + "riae.el.iwfse.o.oqss\n", + "evcsr...n..sd.dv..r.\n", + "pestdewels..e.aw.ut.\n", + "mrlimmersionrl.ob.e.\n", + "iyllatnemadnufwls.nl\n", + "..sdboomovulesivl.ri\n", + ".eiepsreggij.tdeljif\n", + "dkwn.atread..oereiat\n", + "uais..efile..pnihlhi\n", + "rhkripelyt.illsnst.n\n", + "iweekendunotablete.g\n", + "nfondlyrytsenohsuo..\n", + "g.mriffa....naysnp..\n", + ".meatspoodle.within.\n", + "cstriggerpessegassum\n", + "acselacsytapriijpgcr\n", + "moeclienterrtemnuaie\n", + "apisearsclmookvpmntp\n", + "lebpgatohlucfaeaespe\n", + "ifbisevxaafeesrlurol\n", + "riaehelciwfseioioqss\n", + "evcsrkuynpasdfdvetrq\n", + "pestdewelsniegawkutd\n", + "mrlimmersionrloobuel\n", + "iyllatnemadnufwlsanl\n", + "dwsdboomovulesivlyri\n", + "oeiepsreggijntdeljif\n", + "dkwnkatreadvnoereiat\n", + "uaiscuefilehapnihlhi\n", + "rhkripelytqillsnsten\n", + "iweekendunotabletetg\n", + "nfondlyrytsenohsuocc\n", + "gemriffanternaysnpef\n", + "bmeatspoodleswithing\n", + "62 words added; 8 directions\n", + "Present: adore affirm ages boom burs chain client dens during earmuff feeder file fiver fondly fundamentally hairnet hake honesty ills immersion imperil jiggers jilt kiwis lama leap legs lifting meat muss nays notable nutshells optic oval overtly ovule pies poet poodle process quavers repels ripely sake scabbiest scale scope sears simpers slewed snag spume stop tread trigger turfs wallet weekend widen within wolverines\n", + "Decoys: chitchats colloquium conveyances convulsively debates dieting dudes dumpster dwarfed experienced feasibility festooning groupie grunted highfalutin humanise incubuses infiltrate ingratiated jotting linearly lotus masculines meanders nucleuses plunks ponderously prerecording riskiest scavenging splashier sportsmanship strawberry twirler unjustified wariness wavy yeast\n" ] } ], @@ -1118,6 +1170,7 @@ "g, ws = interesting_grid()\n", "p = pad_grid(g)\n", "ds = decoys(p, ws, ws_words)\n", + "print(show_grid(g))\n", "print(show_grid(p))\n", "print(len(ws), 'words added; ', len(set(present(g, w)[3] for w in ws)), 'directions')\n", "print('Present:', wcat(sorted(ws)))\n", @@ -1126,9 +1179,10 @@ }, { "cell_type": "code", - "execution_count": 49, + "execution_count": 143, "metadata": { - "collapsed": false + "collapsed": false, + "scrolled": true }, "outputs": [ { @@ -1154,12 +1208,92 @@ "16\n", "17\n", "18\n", - "19\n" + "19\n", + "20\n", + "21\n", + "22\n", + "23\n", + "24\n", + "25\n", + "26\n", + "27\n", + "28\n", + "29\n", + "30\n", + "31\n", + "32\n", + "33\n", + "34\n", + "35\n", + "36\n", + "37\n", + "38\n", + "39\n", + "40\n", + "41\n", + "42\n", + "43\n", + "44\n", + "45\n", + "46\n", + "47\n", + "48\n", + "49\n", + "50\n", + "51\n", + "52\n", + "53\n", + "54\n", + "55\n", + "56\n", + "57\n", + "58\n", + "59\n", + "60\n", + "61\n", + "62\n", + "63\n", + "64\n", + "65\n", + "66\n", + "67\n", + "68\n", + "69\n", + "70\n", + "71\n", + "72\n", + "73\n", + "74\n", + "75\n", + "76\n", + "77\n", + "78\n", + "79\n", + "80\n", + "81\n", + "82\n", + "83\n", + "84\n", + "85\n", + "86\n", + "87\n", + "88\n", + "89\n", + "90\n", + "91\n", + "92\n", + "93\n", + "94\n", + "95\n", + "96\n", + "97\n", + "98\n", + "99\n" ] } ], "source": [ - "for i in range(20):\n", + "for i in range(100):\n", " print(i)\n", " g, ws = interesting_grid()\n", " p = pad_grid(g)\n", @@ -1203,7 +1337,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.5.2+" + "version": "3.5.2" } }, "nbformat": 4,