"cells": [
{
"cell_type": "code",
- "execution_count": 2,
+ "execution_count": 65,
"metadata": {
"collapsed": false
},
},
{
"cell_type": "code",
- "execution_count": 3,
+ "execution_count": 66,
"metadata": {
"collapsed": false
},
},
{
"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
},
},
{
"cell_type": "code",
- "execution_count": 6,
+ "execution_count": 70,
"metadata": {
"collapsed": true
},
},
{
"cell_type": "code",
- "execution_count": 7,
+ "execution_count": 71,
"metadata": {
"collapsed": false
},
},
{
"cell_type": "code",
- "execution_count": 8,
+ "execution_count": 72,
"metadata": {
"collapsed": true
},
},
{
"cell_type": "code",
- "execution_count": 9,
+ "execution_count": 73,
"metadata": {
"collapsed": true
},
},
{
"cell_type": "code",
- "execution_count": 10,
+ "execution_count": 74,
"metadata": {
"collapsed": true
},
},
{
"cell_type": "code",
- "execution_count": 11,
+ "execution_count": 75,
"metadata": {
"collapsed": false
},
},
{
"cell_type": "code",
- "execution_count": 12,
+ "execution_count": 76,
"metadata": {
"collapsed": false
},
"'..e.....'"
]
},
- "execution_count": 12,
+ "execution_count": 76,
"metadata": {},
"output_type": "execute_result"
}
},
{
"cell_type": "code",
- "execution_count": 13,
+ "execution_count": 77,
"metadata": {
"collapsed": false
},
"<_sre.SRE_Match object; span=(0, 4), match='keen'>"
]
},
- "execution_count": 13,
+ "execution_count": 77,
"metadata": {},
"output_type": "execute_result"
}
},
{
"cell_type": "code",
- "execution_count": 14,
+ "execution_count": 78,
"metadata": {
"collapsed": false
},
"<_sre.SRE_Match object; span=(0, 3), match='kee'>"
]
},
- "execution_count": 14,
+ "execution_count": 78,
"metadata": {},
"output_type": "execute_result"
}
},
{
"cell_type": "code",
- "execution_count": 15,
+ "execution_count": 79,
"metadata": {
"collapsed": false
},
},
{
"cell_type": "code",
- "execution_count": 16,
+ "execution_count": 80,
"metadata": {
"collapsed": true
},
},
{
"cell_type": "code",
- "execution_count": 17,
+ "execution_count": 81,
"metadata": {
"collapsed": true
},
},
{
"cell_type": "code",
- "execution_count": 18,
+ "execution_count": 82,
"metadata": {
"collapsed": false
},
"<_sre.SRE_Match object; span=(0, 4), match='keen'>"
]
},
- "execution_count": 18,
+ "execution_count": 82,
"metadata": {},
"output_type": "execute_result"
}
},
{
"cell_type": "code",
- "execution_count": 19,
+ "execution_count": 83,
"metadata": {
"collapsed": false
},
},
{
"cell_type": "code",
- "execution_count": 20,
+ "execution_count": 84,
"metadata": {
"collapsed": false
},
{
"data": {
"text/plain": [
- "<Direction.up: 3>"
+ "<Direction.downleft: 7>"
]
},
- "execution_count": 20,
+ "execution_count": 84,
"metadata": {},
"output_type": "execute_result"
}
},
{
"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",
" 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",
},
{
"cell_type": "code",
- "execution_count": 22,
+ "execution_count": 86,
"metadata": {
"collapsed": false
},
{
"data": {
"text/plain": [
- "35"
+ "40"
]
},
- "execution_count": 22,
+ "execution_count": 86,
"metadata": {},
"output_type": "execute_result"
}
},
{
"cell_type": "code",
- "execution_count": 23,
+ "execution_count": 87,
"metadata": {
"collapsed": false
},
"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"
]
}
],
},
{
"cell_type": "code",
- "execution_count": 24,
+ "execution_count": 88,
"metadata": {
"collapsed": true
},
},
{
"cell_type": "code",
- "execution_count": 25,
+ "execution_count": 89,
"metadata": {
"collapsed": false,
"scrolled": true
"name": "stdout",
"output_type": "stream",
"text": [
- "ineluctably (True, 16, 15, <Direction.upleft: 5>)\n",
- "limpness (True, 0, 16, <Direction.downleft: 7>)\n",
- "countrymen (True, 2, 1, <Direction.down: 4>)\n",
- "slinking (True, 15, 11, <Direction.left: 1>)\n",
- "beaching (True, 8, 17, <Direction.down: 4>)\n",
- "restocking (True, 9, 5, <Direction.upright: 6>)\n",
- "vellum (True, 14, 8, <Direction.upright: 6>)\n",
- "convoyed (True, 4, 4, <Direction.down: 4>)\n",
- "winterises (True, 12, 0, <Direction.up: 3>)\n",
- "tusked (True, 9, 12, <Direction.upleft: 5>)\n",
- "leathernecks (True, 17, 15, <Direction.left: 1>)\n",
- "sugarcoated (True, 11, 12, <Direction.upleft: 5>)\n",
- "mayfly (True, 13, 18, <Direction.down: 4>)\n",
- "mulching (True, 11, 7, <Direction.downleft: 7>)\n",
- "popinjays (True, 18, 5, <Direction.right: 2>)\n",
- "magnitudes (True, 3, 14, <Direction.down: 4>)\n",
- "unsnapped (True, 1, 3, <Direction.right: 2>)\n",
- "prudential (True, 3, 3, <Direction.down: 4>)\n",
- "yapping (True, 16, 9, <Direction.left: 1>)\n",
- "spuds (True, 19, 7, <Direction.right: 2>)\n",
- "softest (True, 5, 15, <Direction.down: 4>)\n",
- "boron (True, 11, 5, <Direction.downleft: 7>)\n",
- "craning (True, 2, 11, <Direction.left: 1>)\n",
- "unemployable (True, 0, 18, <Direction.down: 4>)\n",
- "reformers (True, 14, 16, <Direction.up: 3>)\n",
- "bicycles (True, 11, 8, <Direction.downright: 8>)\n",
- "swooping (True, 0, 6, <Direction.right: 2>)\n",
- "recondite (True, 10, 2, <Direction.up: 3>)\n",
- "dowdiness (True, 15, 19, <Direction.up: 3>)\n",
- "gumming (True, 19, 6, <Direction.left: 1>)\n",
- "pervades (True, 0, 19, <Direction.down: 4>)\n",
- "beveled (True, 8, 12, <Direction.downleft: 7>)\n",
- "valises (True, 3, 15, <Direction.downleft: 7>)\n",
- "suppler (True, 19, 19, <Direction.left: 1>)\n",
- "prated (True, 16, 1, <Direction.upright: 6>)\n"
+ "understands (True, 18, 1, <Direction.right: 2>)\n",
+ "crappiest (True, 11, 8, <Direction.right: 2>)\n",
+ "archery (True, 1, 10, <Direction.downleft: 7>)\n",
+ "mallows (True, 12, 7, <Direction.upleft: 5>)\n",
+ "depraved (True, 12, 8, <Direction.right: 2>)\n",
+ "cawing (True, 1, 12, <Direction.right: 2>)\n",
+ "rawest (True, 9, 11, <Direction.upleft: 5>)\n",
+ "curd (True, 15, 9, <Direction.right: 2>)\n",
+ "tiny (True, 8, 12, <Direction.upright: 6>)\n",
+ "tiddlywinks (True, 18, 19, <Direction.up: 3>)\n",
+ "fiestas (True, 0, 2, <Direction.right: 2>)\n",
+ "zombi (True, 14, 17, <Direction.left: 1>)\n",
+ "duties (True, 16, 7, <Direction.left: 1>)\n",
+ "ricochet (True, 13, 9, <Direction.right: 2>)\n",
+ "uneconomical (True, 11, 0, <Direction.up: 3>)\n",
+ "hope (True, 5, 13, <Direction.upleft: 5>)\n",
+ "litchis (True, 17, 3, <Direction.right: 2>)\n",
+ "strongly (True, 2, 12, <Direction.right: 2>)\n",
+ "verified (True, 19, 18, <Direction.up: 3>)\n",
+ "logging (True, 13, 8, <Direction.left: 1>)\n",
+ "handing (True, 5, 12, <Direction.downright: 8>)\n",
+ "anonymous (True, 8, 1, <Direction.down: 4>)\n",
+ "quaver (True, 5, 4, <Direction.upright: 6>)\n",
+ "flours (True, 4, 13, <Direction.downright: 8>)\n",
+ "boost (True, 3, 10, <Direction.downleft: 7>)\n",
+ "holy (True, 6, 16, <Direction.up: 3>)\n",
+ "saffrons (True, 0, 17, <Direction.left: 1>)\n",
+ "errs (True, 9, 9, <Direction.right: 2>)\n",
+ "hooligan (True, 19, 11, <Direction.left: 1>)\n",
+ "male (True, 3, 9, <Direction.downright: 8>)\n",
+ "belong (True, 7, 3, <Direction.up: 3>)\n",
+ "tumor (True, 17, 16, <Direction.left: 1>)\n",
+ "dishevel (True, 16, 15, <Direction.left: 1>)\n",
+ "fuzzed (True, 7, 11, <Direction.upleft: 5>)\n",
+ "raglans (True, 10, 16, <Direction.left: 1>)\n",
+ "pensively (True, 14, 4, <Direction.right: 2>)\n",
+ "murks (True, 8, 18, <Direction.up: 3>)\n",
+ "dents (True, 5, 1, <Direction.upright: 6>)\n",
+ "cilia (True, 11, 8, <Direction.up: 3>)\n",
+ "doors (True, 9, 14, <Direction.upleft: 5>)\n"
]
}
],
},
{
"cell_type": "code",
- "execution_count": 26,
+ "execution_count": 125,
"metadata": {
"collapsed": true
},
"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
},
"False"
]
},
- "execution_count": 27,
+ "execution_count": 126,
"metadata": {},
"output_type": "execute_result"
}
},
{
"cell_type": "code",
- "execution_count": 28,
+ "execution_count": 131,
"metadata": {
"collapsed": true
},
" 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
},
"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"
]
}
],
},
{
"cell_type": "code",
- "execution_count": 30,
+ "execution_count": 94,
"metadata": {
"collapsed": true
},
},
{
"cell_type": "code",
- "execution_count": 31,
+ "execution_count": 95,
"metadata": {
"collapsed": true
},
},
{
"cell_type": "code",
- "execution_count": 32,
+ "execution_count": 96,
"metadata": {
"collapsed": false
},
},
{
"cell_type": "code",
- "execution_count": 34,
+ "execution_count": 97,
"metadata": {
"collapsed": false
},
},
{
"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
},
},
{
"cell_type": "code",
- "execution_count": 36,
+ "execution_count": 99,
"metadata": {
"collapsed": false
},
{
"data": {
"text/plain": [
- "'aaaaaaaabcccddddeeeeeeeeeeeeeeefffggghhhhhiiiiiillllmnnnnnnoooooooooprrsssssssssssssttttttttuuuvwwwy'"
+ "'aaaaaaaaaabcdddeeeeeeeeeeeefffffgghhhhhhhhhiiiiiiikllmnnnnnnnooooooooprrrrssssssssssssttttttuuvwwwww'"
]
},
- "execution_count": 36,
+ "execution_count": 99,
"metadata": {},
"output_type": "execute_result"
}
},
{
"cell_type": "code",
- "execution_count": 37,
+ "execution_count": 100,
"metadata": {
"collapsed": false
},
{
"data": {
"text/plain": [
- "'aaaaaabcccddddddeeeeeeggggghhiiiiiiiiiiiiklllmmmmnnnnnnnnnnoooooooooppprrrrrrrrrssssssttttttuuuwwwyy'"
+ "'aaaaaaccccdddeeeeeeeeeeeeeeeeeeeffgghhiiiiikkklllmmmnnnnnnooooooppprrrrrrrrssssssssttttttuuuuuuvwyyy'"
]
},
- "execution_count": 37,
+ "execution_count": 100,
"metadata": {},
"output_type": "execute_result"
}
},
{
"cell_type": "code",
- "execution_count": 38,
+ "execution_count": 101,
"metadata": {
"collapsed": false
},
{
"data": {
"text/plain": [
- "'a'"
+ "'e'"
]
},
- "execution_count": 38,
+ "execution_count": 101,
"metadata": {},
"output_type": "execute_result"
}
},
{
"cell_type": "code",
- "execution_count": 39,
+ "execution_count": 102,
"metadata": {
"collapsed": true
},
},
{
"cell_type": "code",
- "execution_count": 40,
+ "execution_count": 103,
"metadata": {
"collapsed": false
},
"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"
]
}
],
},
{
"cell_type": "code",
- "execution_count": 41,
+ "execution_count": 104,
"metadata": {
"collapsed": false
},
"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"
]
}
],
},
{
"cell_type": "code",
- "execution_count": 42,
+ "execution_count": 105,
"metadata": {
"collapsed": false,
"scrolled": true
"name": "stdout",
"output_type": "stream",
"text": [
- "wombs (True, 1, 19, <Direction.downleft: 7>)\n",
- "persimmons (True, 14, 7, <Direction.upright: 6>)\n",
- "computerisation (True, 15, 18, <Direction.left: 1>)\n",
- "ascribes (True, 14, 17, <Direction.left: 1>)\n",
- "coopering (True, 1, 11, <Direction.down: 4>)\n",
- "goalies (True, 17, 12, <Direction.left: 1>)\n",
- "beamed (True, 3, 0, <Direction.down: 4>)\n",
- "modifying (True, 11, 19, <Direction.down: 4>)\n",
- "insets (True, 13, 2, <Direction.right: 2>)\n",
- "cigarets (True, 12, 3, <Direction.up: 3>)\n",
- "statures (True, 2, 7, <Direction.left: 1>)\n",
- "libels (True, 6, 7, <Direction.down: 4>)\n",
- "remarked (True, 3, 19, <Direction.down: 4>)\n",
- "baggy (True, 13, 11, <Direction.right: 2>)\n",
- "juxtaposes (True, 19, 17, <Direction.left: 1>)\n",
- "mesdames (True, 7, 13, <Direction.up: 3>)\n",
- "grumpiness (True, 4, 17, <Direction.down: 4>)\n",
- "artefacts (True, 16, 6, <Direction.right: 2>)\n",
- "skeins (True, 10, 2, <Direction.down: 4>)\n",
- "assizes (True, 6, 12, <Direction.up: 3>)\n",
- "inflow (True, 6, 5, <Direction.upright: 6>)\n",
- "depleting (True, 7, 1, <Direction.down: 4>)\n",
- "beeped (True, 11, 16, <Direction.left: 1>)\n",
- "reneges (True, 18, 17, <Direction.left: 1>)\n",
- "interning (True, 12, 13, <Direction.left: 1>)\n",
- "yellowish (True, 2, 10, <Direction.down: 4>)\n",
- "regicides (True, 19, 0, <Direction.right: 2>)\n",
- "eyelids (True, 18, 5, <Direction.right: 2>)\n",
- "cools (True, 7, 9, <Direction.upleft: 5>)\n",
- "orgy (True, 7, 18, <Direction.up: 3>)\n",
- "nifty (True, 8, 4, <Direction.up: 3>)\n",
- "knottier (True, 0, 9, <Direction.left: 1>)\n",
- "destroyers (True, 8, 0, <Direction.down: 4>)\n",
- "unfurls (True, 14, 18, <Direction.up: 3>)\n",
- "tinctured (True, 1, 0, <Direction.right: 2>)\n",
- "bigamy (True, 4, 2, <Direction.down: 4>)\n",
- "winos (True, 17, 14, <Direction.right: 2>)\n",
- "essays (True, 11, 9, <Direction.left: 1>)\n"
+ "thralled (True, 2, 2, <Direction.right: 2>)\n",
+ "slung (True, 9, 4, <Direction.up: 3>)\n",
+ "freighted (True, 8, 12, <Direction.down: 4>)\n",
+ "townhouse (True, 18, 2, <Direction.upright: 6>)\n",
+ "salute (True, 12, 11, <Direction.left: 1>)\n",
+ "phoebes (True, 10, 6, <Direction.up: 3>)\n",
+ "faltered (True, 18, 19, <Direction.left: 1>)\n",
+ "laywomen (True, 19, 12, <Direction.upleft: 5>)\n",
+ "squeaked (True, 8, 17, <Direction.up: 3>)\n",
+ "perforating (True, 15, 15, <Direction.up: 3>)\n",
+ "iodise (True, 4, 7, <Direction.down: 4>)\n",
+ "lacier (True, 8, 10, <Direction.downleft: 7>)\n",
+ "autoimmune (True, 0, 3, <Direction.right: 2>)\n",
+ "tinging (True, 16, 1, <Direction.up: 3>)\n",
+ "snagged (True, 1, 10, <Direction.down: 4>)\n",
+ "splendidest (True, 8, 0, <Direction.down: 4>)\n",
+ "roughed (True, 10, 9, <Direction.upright: 6>)\n",
+ "crevasse (True, 11, 18, <Direction.up: 3>)\n",
+ "lone (True, 15, 17, <Direction.up: 3>)\n",
+ "ecologists (True, 12, 16, <Direction.up: 3>)\n",
+ "sponge (True, 13, 13, <Direction.up: 3>)\n",
+ "magnetising (True, 1, 14, <Direction.down: 4>)\n",
+ "sneezing (True, 3, 7, <Direction.left: 1>)\n",
+ "virulent (True, 13, 19, <Direction.up: 3>)\n",
+ "flight (True, 19, 3, <Direction.right: 2>)\n",
+ "sirup (True, 4, 3, <Direction.down: 4>)\n",
+ "yacht (True, 13, 18, <Direction.down: 4>)\n",
+ "random (True, 13, 15, <Direction.downleft: 7>)\n",
+ "accusations (True, 7, 2, <Direction.down: 4>)\n",
+ "wiled (True, 3, 13, <Direction.downleft: 7>)\n",
+ "paved (True, 8, 3, <Direction.down: 4>)\n",
+ "majorly (True, 1, 0, <Direction.right: 2>)\n",
+ "miser (True, 4, 1, <Direction.down: 4>)\n",
+ "memoir (True, 11, 5, <Direction.up: 3>)\n",
+ "emends (True, 14, 5, <Direction.downright: 8>)\n",
+ "slurs (True, 17, 12, <Direction.right: 2>)\n",
+ "clunk (True, 6, 11, <Direction.down: 4>)\n",
+ "erases (True, 1, 7, <Direction.right: 2>)\n",
+ "quasi (True, 19, 15, <Direction.right: 2>)\n"
]
}
],
},
{
"cell_type": "code",
- "execution_count": 51,
+ "execution_count": 141,
"metadata": {
"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 len(d) < dlen_limit 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": 52,
+ "execution_count": 135,
"metadata": {
"collapsed": false
},
{
"data": {
"text/plain": [
- "['ditches',\n",
- " 'fuzes',\n",
- " 'antivirals',\n",
- " 'chronology',\n",
- " 'yacked',\n",
- " 'percentages',\n",
- " 'heftier',\n",
- " 'inimitably',\n",
- " 'conveys',\n",
- " 'remaindered',\n",
- " 'retaken',\n",
- " 'reckoned',\n",
- " 'emery',\n",
- " 'squats',\n",
- " 'tenderfoots',\n",
- " 'sociology',\n",
- " 'arbutuses',\n",
- " 'betook',\n",
- " 'coniferous',\n",
- " 'gambled',\n",
- " 'crouching']"
+ "['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": 52,
+ "execution_count": 135,
"metadata": {},
"output_type": "execute_result"
}
},
{
"cell_type": "code",
- "execution_count": 53,
+ "execution_count": 108,
"metadata": {
"collapsed": false,
"scrolled": true
"name": "stdout",
"output_type": "stream",
"text": [
- "freckled (False, 0, 0, <Direction.left: 1>)\n",
- "transcripts (False, 0, 0, <Direction.left: 1>)\n",
- "dinnering (False, 0, 0, <Direction.left: 1>)\n",
- "insulating (False, 0, 0, <Direction.left: 1>)\n",
- "regurgitates (False, 0, 0, <Direction.left: 1>)\n",
- "drouthes (False, 0, 0, <Direction.left: 1>)\n",
- "cocky (False, 0, 0, <Direction.left: 1>)\n",
- "stodgy (False, 0, 0, <Direction.left: 1>)\n",
- "bestrides (False, 0, 0, <Direction.left: 1>)\n",
- "perceives (False, 0, 0, <Direction.left: 1>)\n",
- "waned (False, 0, 0, <Direction.left: 1>)\n",
- "pisses (False, 0, 0, <Direction.left: 1>)\n",
- "alienating (False, 0, 0, <Direction.left: 1>)\n",
- "hyperbolas (False, 0, 0, <Direction.left: 1>)\n",
- "yeshivoth (False, 0, 0, <Direction.left: 1>)\n",
- "allured (False, 0, 0, <Direction.left: 1>)\n",
- "outstaying (False, 0, 0, <Direction.left: 1>)\n",
- "bureaus (False, 0, 0, <Direction.left: 1>)\n",
- "tragedians (False, 0, 0, <Direction.left: 1>)\n",
- "wooed (False, 0, 0, <Direction.left: 1>)\n",
- "unwary (False, 0, 0, <Direction.left: 1>)\n",
- "provoking (False, 0, 0, <Direction.left: 1>)\n",
- "curies (False, 0, 0, <Direction.left: 1>)\n",
- "deviltry (False, 0, 0, <Direction.left: 1>)\n",
- "wooly (False, 0, 0, <Direction.left: 1>)\n",
- "abysmally (False, 0, 0, <Direction.left: 1>)\n",
- "ladled (False, 0, 0, <Direction.left: 1>)\n",
- "tamable (False, 0, 0, <Direction.left: 1>)\n",
- "minors (False, 0, 0, <Direction.left: 1>)\n",
- "aortas (False, 0, 0, <Direction.left: 1>)\n",
- "souses (False, 0, 0, <Direction.left: 1>)\n",
- "heinously (False, 0, 0, <Direction.left: 1>)\n",
- "cardiac (False, 0, 0, <Direction.left: 1>)\n",
- "peons (True, 17, 1, <Direction.right: 2>)\n",
- "karate (False, 0, 0, <Direction.left: 1>)\n",
- "tansy (False, 0, 0, <Direction.left: 1>)\n",
- "unruly (False, 0, 0, <Direction.left: 1>)\n",
- "absently (False, 0, 0, <Direction.left: 1>)\n",
- "pads (False, 0, 0, <Direction.left: 1>)\n",
- "ditches (False, 0, 0, <Direction.left: 1>)\n",
- "fuzes (False, 0, 0, <Direction.left: 1>)\n",
- "antivirals (False, 0, 0, <Direction.left: 1>)\n",
- "chronology (False, 0, 0, <Direction.left: 1>)\n",
- "yacked (False, 0, 0, <Direction.left: 1>)\n",
- "percentages (False, 0, 0, <Direction.left: 1>)\n",
- "heftier (False, 0, 0, <Direction.left: 1>)\n",
- "inimitably (False, 0, 0, <Direction.left: 1>)\n",
- "conveys (False, 0, 0, <Direction.left: 1>)\n",
- "remaindered (False, 0, 0, <Direction.left: 1>)\n",
- "retaken (False, 0, 0, <Direction.left: 1>)\n",
- "reckoned (False, 0, 0, <Direction.left: 1>)\n",
- "emery (False, 0, 0, <Direction.left: 1>)\n",
- "squats (False, 0, 0, <Direction.left: 1>)\n",
- "tenderfoots (False, 0, 0, <Direction.left: 1>)\n",
- "sociology (False, 0, 0, <Direction.left: 1>)\n",
- "arbutuses (False, 0, 0, <Direction.left: 1>)\n",
- "betook (False, 0, 0, <Direction.left: 1>)\n",
- "coniferous (False, 0, 0, <Direction.left: 1>)\n",
- "gambled (False, 0, 0, <Direction.left: 1>)\n",
- "crouching (False, 0, 0, <Direction.left: 1>)\n"
+ "thralled (True, 2, 2, <Direction.right: 2>)\n",
+ "slung (True, 9, 4, <Direction.up: 3>)\n",
+ "freighted (True, 8, 12, <Direction.down: 4>)\n",
+ "townhouse (True, 18, 2, <Direction.upright: 6>)\n",
+ "salute (True, 12, 11, <Direction.left: 1>)\n",
+ "phoebes (True, 10, 6, <Direction.up: 3>)\n",
+ "faltered (True, 18, 19, <Direction.left: 1>)\n",
+ "laywomen (True, 19, 12, <Direction.upleft: 5>)\n",
+ "squeaked (True, 8, 17, <Direction.up: 3>)\n",
+ "perforating (True, 15, 15, <Direction.up: 3>)\n",
+ "iodise (True, 4, 7, <Direction.down: 4>)\n",
+ "lacier (True, 8, 10, <Direction.downleft: 7>)\n",
+ "autoimmune (True, 0, 3, <Direction.right: 2>)\n",
+ "tinging (True, 16, 1, <Direction.up: 3>)\n",
+ "snagged (True, 1, 10, <Direction.down: 4>)\n",
+ "splendidest (True, 8, 0, <Direction.down: 4>)\n",
+ "roughed (True, 10, 9, <Direction.upright: 6>)\n",
+ "crevasse (True, 11, 18, <Direction.up: 3>)\n",
+ "lone (True, 15, 17, <Direction.up: 3>)\n",
+ "ecologists (True, 12, 16, <Direction.up: 3>)\n",
+ "sponge (True, 13, 13, <Direction.up: 3>)\n",
+ "magnetising (True, 1, 14, <Direction.down: 4>)\n",
+ "sneezing (True, 3, 7, <Direction.left: 1>)\n",
+ "virulent (True, 13, 19, <Direction.up: 3>)\n",
+ "flight (True, 19, 3, <Direction.right: 2>)\n",
+ "sirup (True, 4, 3, <Direction.down: 4>)\n",
+ "yacht (True, 13, 18, <Direction.down: 4>)\n",
+ "random (True, 13, 15, <Direction.downleft: 7>)\n",
+ "accusations (True, 7, 2, <Direction.down: 4>)\n",
+ "wiled (True, 3, 13, <Direction.downleft: 7>)\n",
+ "paved (True, 8, 3, <Direction.down: 4>)\n",
+ "majorly (True, 1, 0, <Direction.right: 2>)\n",
+ "miser (True, 4, 1, <Direction.down: 4>)\n",
+ "memoir (True, 11, 5, <Direction.up: 3>)\n",
+ "emends (True, 14, 5, <Direction.downright: 8>)\n",
+ "slurs (True, 17, 12, <Direction.right: 2>)\n",
+ "clunk (True, 6, 11, <Direction.down: 4>)\n",
+ "erases (True, 1, 7, <Direction.right: 2>)\n",
+ "quasi (True, 19, 15, <Direction.right: 2>)\n",
+ "leakiest (False, 0, 0, <Direction.left: 1>)\n",
+ "lumpiest (False, 0, 0, <Direction.left: 1>)\n",
+ "bastion (False, 0, 0, <Direction.left: 1>)\n",
+ "steamier (False, 0, 0, <Direction.left: 1>)\n",
+ "elegant (False, 0, 0, <Direction.left: 1>)\n",
+ "slogging (False, 0, 0, <Direction.left: 1>)\n",
+ "rejects (False, 0, 0, <Direction.left: 1>)\n",
+ "gaze (False, 0, 0, <Direction.left: 1>)\n",
+ "swopping (False, 0, 0, <Direction.left: 1>)\n",
+ "resonances (False, 0, 0, <Direction.left: 1>)\n",
+ "treasonous (False, 0, 0, <Direction.left: 1>)\n",
+ "corm (False, 0, 0, <Direction.left: 1>)\n",
+ "abuses (False, 0, 0, <Direction.left: 1>)\n",
+ "toga (False, 0, 0, <Direction.left: 1>)\n",
+ "upcountry (False, 0, 0, <Direction.left: 1>)\n",
+ "scrawled (False, 0, 0, <Direction.left: 1>)\n",
+ "cellar (False, 0, 0, <Direction.left: 1>)\n",
+ "skinflint (False, 0, 0, <Direction.left: 1>)\n",
+ "wasteland (False, 0, 0, <Direction.left: 1>)\n",
+ "madman (False, 0, 0, <Direction.left: 1>)\n",
+ "lash (False, 0, 0, <Direction.left: 1>)\n"
]
}
],
},
{
"cell_type": "code",
- "execution_count": 54,
+ "execution_count": 142,
"metadata": {
"collapsed": false
},
"name": "stdout",
"output_type": "stream",
"text": [
- "ihaceglstcongealedim\n",
- "locnlanmecdwsieyieyp\n",
- "uslrbacimdmedruyirfo\n",
- "hyacaascsatireeaiefm\n",
- "epyatooheutryldpifum\n",
- "chiuantaedrivgeouihe\n",
- "diehehdftsionrsdmoil\n",
- "ylrnpsounaonhspadtrs\n",
- "linhegiglgirgcidagug\n",
- "gsaornesallliseilnwo\n",
- "nlnenigpsnnhllsrlins\n",
- "ityvuprergselipdohyi\n",
- "mstismocwduusngeygsw\n",
- "oextoooincnhksshsuci\n",
- "cmiiprvfanedcwuctook\n",
- "ersnptyiaclippingsur\n",
- "biauindcemostlysietd\n",
- "rflpebesmsskrepppsil\n",
- "yssorgnileereouepyna\n",
- "taeaeweathercockswgs\n",
- "36 words added; 7 directions\n",
- "Present: acceding alloys annulled becomingly chorusing chugs clashes clayier clippings congealed dullness espies firmest groovy groupers hogans huffy kiwis matins mostly outmoded perks pommels punitive reeling scouting sixty soppier soughing specifics syphilis taillights tromping unrepeatable weathercocks wispy\n",
- "Decoys: belittled buzzwords climbs congaed criterions drifters exteriors filial flattery gambolling haversacks insiders interferon leukaemia liabilities mavens mentalities padlocking ptarmigans puking retarded seaming skimpiness wanderers\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"
]
}
],
"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",
},
{
"cell_type": "code",
- "execution_count": 55,
+ "execution_count": 143,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "scrolled": true
},
"outputs": [
{
"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",
"cells": [
{
"cell_type": "code",
- "execution_count": 106,
+ "execution_count": 13,
"metadata": {
"collapsed": false
},
},
{
"cell_type": "code",
- "execution_count": 46,
+ "execution_count": 14,
"metadata": {
"collapsed": true
},
},
{
"cell_type": "code",
- "execution_count": 47,
+ "execution_count": 15,
"metadata": {
"collapsed": true
},
},
{
"cell_type": "code",
- "execution_count": 48,
+ "execution_count": 16,
"metadata": {
"collapsed": true
},
},
{
"cell_type": "code",
- "execution_count": 49,
+ "execution_count": 17,
"metadata": {
"collapsed": true
},
},
{
"cell_type": "code",
- "execution_count": 50,
+ "execution_count": 18,
"metadata": {
"collapsed": true
},
},
{
"cell_type": "code",
- "execution_count": 51,
- "metadata": {
- "collapsed": true
- },
- "outputs": [],
- "source": [
- "def could_add(grid, r, c, d, word):\n",
- " s = gslice(grid, r, c, len(word), d)\n",
- " return re.fullmatch(cat(s), word)"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 52,
+ "execution_count": 20,
"metadata": {
"collapsed": true
},
},
{
"cell_type": "code",
- "execution_count": 53,
- "metadata": {
- "collapsed": true
- },
- "outputs": [],
- "source": [
- "def pad_grid(g0):\n",
- " grid = copy.deepcopy(g0)\n",
- " w = len(grid[0])\n",
- " h = len(grid)\n",
- " for r in range(h):\n",
- " for c in range(w):\n",
- " if grid[r][c] == '.':\n",
- " grid[r][c] = random_wordsearch_letter()\n",
- " return grid"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 54,
+ "execution_count": 22,
"metadata": {
"collapsed": false
},
},
{
"cell_type": "code",
- "execution_count": 77,
+ "execution_count": 50,
"metadata": {
"collapsed": false,
"scrolled": true
{
"data": {
"text/plain": [
- "(['iisnoitpircserpoacos',\n",
- " 'eohgiodnpgbeautypoar',\n",
- " 'arsllorcsnestdomofne',\n",
- " 'irfdeemseirrgarnlfrb',\n",
- " 'tclumpingkoeasevoedm',\n",
- " 'hetobsibecgftdcmgrvi',\n",
- " 'isesrepoeuelmsriyset',\n",
- " 'eknaodouusnoedetoxes',\n",
- " 'vldwiarsoiogsstiedue',\n",
- " 'ehealcegdsuidsesuifi',\n",
- " 'dirrsiidnesepmdaelnc',\n",
- " 'nierrrsdeibuwpegriga',\n",
- " 'sprirrsyebniednusirb',\n",
- " 'eeboraisahmieeaycnnw',\n",
- " 'irrrnbrnepcmanhriuug',\n",
- " 'tjasdypeykuanppetiot',\n",
- " 'nuvaaaicssndonrppmer',\n",
- " 'areeioassenyocoaooze',\n",
- " 'hellesoamalabruptest',\n",
- " 'csygsfyosinightclubs'],\n",
- " ['abruptest',\n",
- " 'apology',\n",
- " 'assumed',\n",
- " 'barricades',\n",
- " 'beauty',\n",
- " 'bravely',\n",
- " 'bravos',\n",
- " 'burlier',\n",
- " 'chanties',\n",
- " 'clumping',\n",
- " 'coached',\n",
- " 'coffers',\n",
- " 'coyness',\n",
- " 'decriminalisation',\n",
- " 'detoxes',\n",
- " 'differs',\n",
- " 'duelled',\n",
- " 'duplicating',\n",
- " 'elaborates',\n",
- " 'embroils',\n",
- " 'encirclement',\n",
- " 'erogenous',\n",
- " 'facsimiled',\n",
- " 'festers',\n",
- " 'flickering',\n",
- " 'fusible',\n",
- " 'gluiest',\n",
- " 'golfers',\n",
- " 'interpolations',\n",
- " 'involved',\n",
- " 'irony',\n",
- " 'lithographed',\n",
- " 'nabbed',\n",
- " 'nightclubs',\n",
- " 'oblongs',\n",
- " 'optics',\n",
- " 'orphaned',\n",
- " 'overstates',\n",
- " 'paining',\n",
- " 'papery',\n",
- " 'perjures',\n",
- " 'prescriptions',\n",
- " 'prissier',\n",
- " 'rallies',\n",
- " 'rebated',\n",
- " 'reneges',\n",
- " 'saleswomen',\n",
- " 'scrolls',\n",
- " 'searing',\n",
- " 'slobbering',\n",
- " 'soups',\n",
- " 'sucking',\n",
- " 'tenderer',\n",
- " 'thieved',\n",
- " 'timbers',\n",
- " 'toiletries',\n",
- " 'unabashed',\n",
- " 'warriors',\n",
- " 'wimpy',\n",
- " 'wriest'])"
+ "(['pistrohxegniydutslxt',\n",
+ " 'wmregunarbpiledsyuoo',\n",
+ " 'hojminbmutartslrlmgo',\n",
+ " 'isrsdniiekildabolpll',\n",
+ " 'tstsnyekentypkalases',\n",
+ " 'ssnetengcrfetedirgdt',\n",
+ " 'religstasuslatxauner',\n",
+ " 'elgcpgatsklglzistilo',\n",
+ " 'tndlimitationilkasan',\n",
+ " 'aousropedlygiifeniog',\n",
+ " 'kilrprepszffsyzqsrhs',\n",
+ " 'itlaadorableorpccese',\n",
+ " 'noaeewoodedpngmqicnl',\n",
+ " 'gmrtoitailingchelrok',\n",
+ " 'jadsngninetsahtooeic',\n",
+ " 'xeernighestsailarmtu',\n",
+ " 'aeabsolvednscumdfnon',\n",
+ " 'gydammingawlcandornk',\n",
+ " 'hurlerslvkaccxcinosw',\n",
+ " 'iqnanoitacifitrofqqi'],\n",
+ " ['absolved',\n",
+ " 'adorable',\n",
+ " 'aeon',\n",
+ " 'alias',\n",
+ " 'ancestor',\n",
+ " 'baritone',\n",
+ " 'bemusing',\n",
+ " 'blonds',\n",
+ " 'bran',\n",
+ " 'calcite',\n",
+ " 'candor',\n",
+ " 'conciseness',\n",
+ " 'consequent',\n",
+ " 'cuddle',\n",
+ " 'damming',\n",
+ " 'dashboards',\n",
+ " 'despairing',\n",
+ " 'dint',\n",
+ " 'dullard',\n",
+ " 'dynasty',\n",
+ " 'employer',\n",
+ " 'exhorts',\n",
+ " 'feted',\n",
+ " 'fill',\n",
+ " 'flattens',\n",
+ " 'foghorn',\n",
+ " 'fortification',\n",
+ " 'freakish',\n",
+ " 'frolics',\n",
+ " 'gall',\n",
+ " 'gees',\n",
+ " 'genies',\n",
+ " 'gets',\n",
+ " 'hastening',\n",
+ " 'hits',\n",
+ " 'hopelessness',\n",
+ " 'hurlers',\n",
+ " 'impales',\n",
+ " 'infix',\n",
+ " 'inflow',\n",
+ " 'innumerable',\n",
+ " 'intentional',\n",
+ " 'jerkin',\n",
+ " 'justification',\n",
+ " 'kitty',\n",
+ " 'knuckles',\n",
+ " 'leaving',\n",
+ " 'like',\n",
+ " 'limitation',\n",
+ " 'locoweeds',\n",
+ " 'loot',\n",
+ " 'lucking',\n",
+ " 'lumps',\n",
+ " 'mercerising',\n",
+ " 'monickers',\n",
+ " 'motionless',\n",
+ " 'naturally',\n",
+ " 'nighest',\n",
+ " 'notion',\n",
+ " 'ogled',\n",
+ " 'originality',\n",
+ " 'outings',\n",
+ " 'pendulous',\n",
+ " 'piled',\n",
+ " 'pins',\n",
+ " 'pithier',\n",
+ " 'prep',\n",
+ " 'randomness',\n",
+ " 'rectors',\n",
+ " 'redrew',\n",
+ " 'reformulated',\n",
+ " 'remoteness',\n",
+ " 'retaking',\n",
+ " 'rethink',\n",
+ " 'rope',\n",
+ " 'rubier',\n",
+ " 'sailors',\n",
+ " 'scowls',\n",
+ " 'scum',\n",
+ " 'sepals',\n",
+ " 'sequencers',\n",
+ " 'serf',\n",
+ " 'shoaled',\n",
+ " 'shook',\n",
+ " 'sonic',\n",
+ " 'spottiest',\n",
+ " 'stag',\n",
+ " 'stood',\n",
+ " 'stratum',\n",
+ " 'strong',\n",
+ " 'studying',\n",
+ " 'surtaxing',\n",
+ " 'tailing',\n",
+ " 'tears',\n",
+ " 'teazles',\n",
+ " 'vans',\n",
+ " 'wardrobes',\n",
+ " 'wooded',\n",
+ " 'worsts',\n",
+ " 'zings'])"
]
},
- "execution_count": 77,
+ "execution_count": 50,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
- "width, height, g, ws = read_wordsearch('wordsearch1.txt')\n",
+ "width, height, g, ws = read_wordsearch('wordsearch04.txt')\n",
"g, ws"
]
},
{
"cell_type": "code",
- "execution_count": 78,
+ "execution_count": 51,
"metadata": {
"collapsed": false,
"scrolled": true
"name": "stdout",
"output_type": "stream",
"text": [
- "abruptest (True, 18, 11, <Direction.right: 2>)\n",
- "apology (True, 0, 16, <Direction.down: 4>)\n",
- "assumed (True, 18, 7, <Direction.upright: 6>)\n",
- "barricades (True, 14, 5, <Direction.up: 3>)\n",
- "beauty (True, 1, 10, <Direction.right: 2>)\n",
- "bravely (True, 13, 2, <Direction.down: 4>)\n",
- "bravos (False, 0, 0, <Direction.left: 1>)\n",
- "burlier (False, 0, 0, <Direction.left: 1>)\n",
- "chanties (True, 19, 0, <Direction.up: 3>)\n",
- "clumping (True, 4, 1, <Direction.right: 2>)\n",
- "coached (True, 17, 13, <Direction.upleft: 5>)\n",
- "coffers (True, 0, 17, <Direction.down: 4>)\n",
- "coyness (True, 17, 13, <Direction.left: 1>)\n",
- "decriminalisation (False, 0, 0, <Direction.left: 1>)\n",
- "detoxes (True, 7, 13, <Direction.right: 2>)\n",
- "differs (False, 0, 0, <Direction.left: 1>)\n",
- "duelled (False, 0, 0, <Direction.left: 1>)\n",
- "duplicating (False, 0, 0, <Direction.left: 1>)\n",
- "elaborates (False, 0, 0, <Direction.left: 1>)\n",
- "embroils (True, 3, 4, <Direction.down: 4>)\n",
- "encirclement (False, 0, 0, <Direction.left: 1>)\n",
- "erogenous (True, 2, 10, <Direction.down: 4>)\n",
- "facsimiled (False, 0, 0, <Direction.left: 1>)\n",
- "festers (False, 0, 0, <Direction.left: 1>)\n",
- "flickering (False, 0, 0, <Direction.left: 1>)\n",
- "fusible (False, 0, 0, <Direction.left: 1>)\n",
- "gluiest (True, 11, 18, <Direction.upleft: 5>)\n",
- "golfers (True, 8, 11, <Direction.up: 3>)\n",
- "interpolations (False, 0, 0, <Direction.left: 1>)\n",
- "involved (False, 0, 0, <Direction.left: 1>)\n",
- "irony (True, 11, 1, <Direction.downright: 8>)\n",
- "lithographed (False, 0, 0, <Direction.left: 1>)\n",
- "nabbed (True, 14, 7, <Direction.upright: 6>)\n",
- "nightclubs (True, 19, 10, <Direction.right: 2>)\n",
- "oblongs (False, 0, 0, <Direction.left: 1>)\n",
- "optics (True, 17, 16, <Direction.up: 3>)\n",
- "orphaned (True, 17, 14, <Direction.up: 3>)\n",
- "overstates (False, 0, 0, <Direction.left: 1>)\n",
- "paining (True, 15, 13, <Direction.upleft: 5>)\n",
- "papery (True, 18, 15, <Direction.up: 3>)\n",
- "perjures (True, 12, 1, <Direction.down: 4>)\n",
- "prescriptions (True, 0, 14, <Direction.left: 1>)\n",
- "prissier (True, 15, 6, <Direction.up: 3>)\n",
- "rallies (False, 0, 0, <Direction.left: 1>)\n",
- "rebated (False, 0, 0, <Direction.left: 1>)\n",
- "reneges (False, 0, 0, <Direction.left: 1>)\n",
- "saleswomen (False, 0, 0, <Direction.left: 1>)\n",
- "scrolls (True, 2, 8, <Direction.left: 1>)\n",
- "searing (True, 8, 13, <Direction.downright: 8>)\n",
- "slobbering (False, 0, 0, <Direction.left: 1>)\n",
- "soups (True, 9, 9, <Direction.upleft: 5>)\n",
- "sucking (True, 7, 9, <Direction.up: 3>)\n",
- "tenderer (True, 5, 2, <Direction.down: 4>)\n",
- "thieved (True, 4, 0, <Direction.down: 4>)\n",
- "timbers (True, 6, 19, <Direction.up: 3>)\n",
- "toiletries (False, 0, 0, <Direction.left: 1>)\n",
- "unabashed (False, 0, 0, <Direction.left: 1>)\n",
- "warriors (True, 8, 3, <Direction.down: 4>)\n",
- "wimpy (True, 11, 12, <Direction.downleft: 7>)\n",
- "wriest (True, 13, 19, <Direction.upleft: 5>)\n"
+ "absolved (True, 16, 2, <Direction.right: 2>)\n",
+ "adorable (True, 11, 4, <Direction.right: 2>)\n",
+ "aeon (True, 11, 4, <Direction.down: 4>)\n",
+ "alias (True, 15, 15, <Direction.left: 1>)\n",
+ "ancestor (False, 0, 0, <Direction.left: 1>)\n",
+ "baritone (False, 0, 0, <Direction.left: 1>)\n",
+ "bemusing (False, 0, 0, <Direction.left: 1>)\n",
+ "blonds (False, 0, 0, <Direction.left: 1>)\n",
+ "bran (True, 1, 9, <Direction.left: 1>)\n",
+ "calcite (True, 19, 9, <Direction.upright: 6>)\n",
+ "candor (True, 17, 12, <Direction.right: 2>)\n",
+ "conciseness (False, 0, 0, <Direction.left: 1>)\n",
+ "consequent (False, 0, 0, <Direction.left: 1>)\n",
+ "cuddle (False, 0, 0, <Direction.left: 1>)\n",
+ "damming (True, 17, 2, <Direction.right: 2>)\n",
+ "dashboards (False, 0, 0, <Direction.left: 1>)\n",
+ "despairing (False, 0, 0, <Direction.left: 1>)\n",
+ "dint (False, 0, 0, <Direction.left: 1>)\n",
+ "dullard (True, 8, 2, <Direction.down: 4>)\n",
+ "dynasty (True, 3, 4, <Direction.downright: 8>)\n",
+ "employer (False, 0, 0, <Direction.left: 1>)\n",
+ "exhorts (True, 0, 8, <Direction.left: 1>)\n",
+ "feted (True, 5, 10, <Direction.right: 2>)\n",
+ "fill (True, 9, 14, <Direction.upleft: 5>)\n",
+ "flattens (True, 10, 10, <Direction.upleft: 5>)\n",
+ "foghorn (True, 10, 11, <Direction.downright: 8>)\n",
+ "fortification (True, 19, 16, <Direction.left: 1>)\n",
+ "freakish (False, 0, 0, <Direction.left: 1>)\n",
+ "frolics (True, 16, 16, <Direction.up: 3>)\n",
+ "gall (False, 0, 0, <Direction.left: 1>)\n",
+ "gees (True, 17, 0, <Direction.upright: 6>)\n",
+ "genies (True, 5, 7, <Direction.upleft: 5>)\n",
+ "gets (True, 6, 4, <Direction.upleft: 5>)\n",
+ "hastening (True, 14, 13, <Direction.left: 1>)\n",
+ "hits (True, 2, 0, <Direction.down: 4>)\n",
+ "hopelessness (False, 0, 0, <Direction.left: 1>)\n",
+ "hurlers (True, 18, 0, <Direction.right: 2>)\n",
+ "impales (False, 0, 0, <Direction.left: 1>)\n",
+ "infix (False, 0, 0, <Direction.left: 1>)\n",
+ "inflow (False, 0, 0, <Direction.left: 1>)\n",
+ "innumerable (False, 0, 0, <Direction.left: 1>)\n",
+ "intentional (False, 0, 0, <Direction.left: 1>)\n",
+ "jerkin (False, 0, 0, <Direction.left: 1>)\n",
+ "justification (False, 0, 0, <Direction.left: 1>)\n",
+ "kitty (True, 8, 15, <Direction.upleft: 5>)\n",
+ "knuckles (True, 17, 19, <Direction.up: 3>)\n",
+ "leaving (False, 0, 0, <Direction.left: 1>)\n",
+ "like (True, 3, 11, <Direction.left: 1>)\n",
+ "limitation (True, 8, 3, <Direction.right: 2>)\n",
+ "locoweeds (False, 0, 0, <Direction.left: 1>)\n",
+ "loot (True, 3, 19, <Direction.up: 3>)\n",
+ "lucking (True, 7, 10, <Direction.upleft: 5>)\n",
+ "lumps (True, 0, 17, <Direction.down: 4>)\n",
+ "mercerising (True, 15, 17, <Direction.up: 3>)\n",
+ "monickers (False, 0, 0, <Direction.left: 1>)\n",
+ "motionless (True, 13, 1, <Direction.up: 3>)\n",
+ "naturally (True, 9, 16, <Direction.up: 3>)\n",
+ "nighest (True, 15, 4, <Direction.right: 2>)\n",
+ "notion (True, 17, 18, <Direction.up: 3>)\n",
+ "ogled (True, 1, 18, <Direction.down: 4>)\n",
+ "originality (False, 0, 0, <Direction.left: 1>)\n",
+ "outings (False, 0, 0, <Direction.left: 1>)\n",
+ "pendulous (False, 0, 0, <Direction.left: 1>)\n",
+ "piled (True, 1, 10, <Direction.right: 2>)\n",
+ "pins (True, 7, 4, <Direction.upleft: 5>)\n",
+ "pithier (False, 0, 0, <Direction.left: 1>)\n",
+ "prep (True, 10, 4, <Direction.right: 2>)\n",
+ "randomness (False, 0, 0, <Direction.left: 1>)\n",
+ "rectors (False, 0, 0, <Direction.left: 1>)\n",
+ "redrew (False, 0, 0, <Direction.left: 1>)\n",
+ "reformulated (False, 0, 0, <Direction.left: 1>)\n",
+ "remoteness (False, 0, 0, <Direction.left: 1>)\n",
+ "retaking (True, 6, 0, <Direction.down: 4>)\n",
+ "rethink (False, 0, 0, <Direction.left: 1>)\n",
+ "rope (True, 9, 4, <Direction.right: 2>)\n",
+ "rubier (True, 0, 4, <Direction.downright: 8>)\n",
+ "sailors (True, 7, 15, <Direction.up: 3>)\n",
+ "scowls (False, 0, 0, <Direction.left: 1>)\n",
+ "scum (True, 16, 11, <Direction.right: 2>)\n",
+ "sepals (True, 6, 10, <Direction.upright: 6>)\n",
+ "sequencers (False, 0, 0, <Direction.left: 1>)\n",
+ "serf (False, 0, 0, <Direction.left: 1>)\n",
+ "shoaled (True, 11, 18, <Direction.up: 3>)\n",
+ "shook (False, 0, 0, <Direction.left: 1>)\n",
+ "sonic (True, 18, 18, <Direction.left: 1>)\n",
+ "spottiest (False, 0, 0, <Direction.left: 1>)\n",
+ "stag (True, 7, 8, <Direction.left: 1>)\n",
+ "stood (False, 0, 0, <Direction.left: 1>)\n",
+ "stratum (True, 2, 13, <Direction.left: 1>)\n",
+ "strong (True, 4, 19, <Direction.down: 4>)\n",
+ "studying (True, 0, 16, <Direction.left: 1>)\n",
+ "surtaxing (False, 0, 0, <Direction.left: 1>)\n",
+ "tailing (True, 13, 6, <Direction.right: 2>)\n",
+ "tears (True, 13, 3, <Direction.up: 3>)\n",
+ "teazles (True, 4, 10, <Direction.downright: 8>)\n",
+ "vans (True, 18, 8, <Direction.upright: 6>)\n",
+ "wardrobes (False, 0, 0, <Direction.left: 1>)\n",
+ "wooded (True, 12, 5, <Direction.right: 2>)\n",
+ "worsts (True, 1, 0, <Direction.downright: 8>)\n",
+ "zings (True, 10, 14, <Direction.upleft: 5>)\n"
]
}
],
},
{
"cell_type": "code",
- "execution_count": 79,
+ "execution_count": 52,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "scrolled": true
},
"outputs": [
{
"data": {
"text/plain": [
- "['abruptest',\n",
- " 'apology',\n",
- " 'assumed',\n",
- " 'barricades',\n",
- " 'beauty',\n",
- " 'bravely',\n",
- " 'chanties',\n",
- " 'clumping',\n",
- " 'coached',\n",
- " 'coffers',\n",
- " 'coyness',\n",
- " 'detoxes',\n",
- " 'embroils',\n",
- " 'erogenous',\n",
- " 'gluiest',\n",
- " 'golfers',\n",
- " 'irony',\n",
- " 'nabbed',\n",
- " 'nightclubs',\n",
- " 'optics',\n",
- " 'orphaned',\n",
- " 'paining',\n",
- " 'papery',\n",
- " 'perjures',\n",
- " 'prescriptions',\n",
- " 'prissier',\n",
- " 'scrolls',\n",
- " 'searing',\n",
- " 'soups',\n",
- " 'sucking',\n",
- " 'tenderer',\n",
- " 'thieved',\n",
- " 'timbers',\n",
- " 'warriors',\n",
- " 'wimpy',\n",
- " 'wriest']"
+ "['absolved',\n",
+ " 'adorable',\n",
+ " 'aeon',\n",
+ " 'alias',\n",
+ " 'bran',\n",
+ " 'calcite',\n",
+ " 'candor',\n",
+ " 'damming',\n",
+ " 'dullard',\n",
+ " 'dynasty',\n",
+ " 'exhorts',\n",
+ " 'feted',\n",
+ " 'fill',\n",
+ " 'flattens',\n",
+ " 'foghorn',\n",
+ " 'fortification',\n",
+ " 'frolics',\n",
+ " 'gees',\n",
+ " 'genies',\n",
+ " 'gets',\n",
+ " 'hastening',\n",
+ " 'hits',\n",
+ " 'hurlers',\n",
+ " 'kitty',\n",
+ " 'knuckles',\n",
+ " 'like',\n",
+ " 'limitation',\n",
+ " 'loot',\n",
+ " 'lucking',\n",
+ " 'lumps',\n",
+ " 'mercerising',\n",
+ " 'motionless',\n",
+ " 'naturally',\n",
+ " 'nighest',\n",
+ " 'notion',\n",
+ " 'ogled',\n",
+ " 'piled',\n",
+ " 'pins',\n",
+ " 'prep',\n",
+ " 'retaking',\n",
+ " 'rope',\n",
+ " 'rubier',\n",
+ " 'sailors',\n",
+ " 'scum',\n",
+ " 'sepals',\n",
+ " 'shoaled',\n",
+ " 'sonic',\n",
+ " 'stag',\n",
+ " 'stratum',\n",
+ " 'strong',\n",
+ " 'studying',\n",
+ " 'tailing',\n",
+ " 'tears',\n",
+ " 'teazles',\n",
+ " 'vans',\n",
+ " 'wooded',\n",
+ " 'worsts',\n",
+ " 'zings']"
]
},
- "execution_count": 79,
+ "execution_count": 52,
"metadata": {},
"output_type": "execute_result"
}
},
{
"cell_type": "code",
- "execution_count": 88,
+ "execution_count": 53,
"metadata": {
"collapsed": false
},
{
"data": {
"text/plain": [
- "'prescriptions'"
+ "'fortification'"
]
},
- "execution_count": 88,
+ "execution_count": 53,
"metadata": {},
"output_type": "execute_result"
}
},
{
"cell_type": "code",
- "execution_count": 89,
+ "execution_count": 54,
"metadata": {
"collapsed": false
},
{
"data": {
"text/plain": [
- "'decriminalisation'"
+ "'justification'"
]
},
- "execution_count": 89,
+ "execution_count": 54,
"metadata": {},
"output_type": "execute_result"
}
},
{
"cell_type": "code",
- "execution_count": 82,
+ "execution_count": 55,
"metadata": {
"collapsed": false
},
{
"data": {
"text/plain": [
- "143"
+ "57"
]
},
- "execution_count": 82,
+ "execution_count": 55,
"metadata": {},
"output_type": "execute_result"
}
},
{
"cell_type": "code",
- "execution_count": 83,
+ "execution_count": 56,
"metadata": {
"collapsed": false,
"scrolled": true
{
"data": {
"text/plain": [
- "Counter({'a': 11,\n",
- " 'b': 2,\n",
- " 'c': 3,\n",
- " 'd': 10,\n",
- " 'e': 21,\n",
- " 'f': 3,\n",
- " 'g': 4,\n",
- " 'h': 2,\n",
- " 'i': 15,\n",
- " 'k': 2,\n",
- " 'l': 3,\n",
- " 'm': 7,\n",
- " 'n': 10,\n",
- " 'o': 13,\n",
+ "Counter({'a': 4,\n",
+ " 'b': 1,\n",
+ " 'c': 5,\n",
+ " 'd': 3,\n",
+ " 'e': 1,\n",
+ " 'g': 2,\n",
+ " 'i': 5,\n",
+ " 'j': 2,\n",
+ " 'k': 3,\n",
+ " 'l': 2,\n",
+ " 'm': 3,\n",
+ " 'n': 3,\n",
" 'p': 3,\n",
- " 'r': 9,\n",
- " 's': 12,\n",
- " 't': 2,\n",
- " 'u': 6,\n",
- " 'v': 2,\n",
+ " 'q': 5,\n",
+ " 'r': 3,\n",
+ " 's': 3,\n",
+ " 'w': 2,\n",
+ " 'x': 4,\n",
" 'y': 2,\n",
" 'z': 1})"
]
},
- "execution_count": 83,
+ "execution_count": 56,
"metadata": {},
"output_type": "execute_result"
}
},
{
"cell_type": "code",
- "execution_count": 84,
+ "execution_count": 57,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "scrolled": true
},
"outputs": [
{
"data": {
"text/plain": [
- "['bravos',\n",
- " 'burlier',\n",
- " 'decriminalisation',\n",
- " 'differs',\n",
- " 'duelled',\n",
- " 'duplicating',\n",
- " 'elaborates',\n",
- " 'encirclement',\n",
- " 'facsimiled',\n",
- " 'festers',\n",
- " 'flickering',\n",
- " 'fusible',\n",
- " 'interpolations',\n",
- " 'involved',\n",
- " 'lithographed',\n",
- " 'oblongs',\n",
- " 'overstates',\n",
- " 'rallies',\n",
- " 'rebated',\n",
- " 'reneges',\n",
- " 'saleswomen',\n",
- " 'slobbering',\n",
- " 'toiletries',\n",
- " 'unabashed']"
+ "['ancestor',\n",
+ " 'baritone',\n",
+ " 'bemusing',\n",
+ " 'blonds',\n",
+ " 'conciseness',\n",
+ " 'consequent',\n",
+ " 'cuddle',\n",
+ " 'dashboards',\n",
+ " 'despairing',\n",
+ " 'dint',\n",
+ " 'employer',\n",
+ " 'freakish',\n",
+ " 'gall',\n",
+ " 'hopelessness',\n",
+ " 'impales',\n",
+ " 'infix',\n",
+ " 'inflow',\n",
+ " 'innumerable',\n",
+ " 'intentional',\n",
+ " 'jerkin',\n",
+ " 'justification',\n",
+ " 'leaving',\n",
+ " 'locoweeds',\n",
+ " 'monickers',\n",
+ " 'originality',\n",
+ " 'outings',\n",
+ " 'pendulous',\n",
+ " 'pithier',\n",
+ " 'randomness',\n",
+ " 'rectors',\n",
+ " 'redrew',\n",
+ " 'reformulated',\n",
+ " 'remoteness',\n",
+ " 'rethink',\n",
+ " 'scowls',\n",
+ " 'sequencers',\n",
+ " 'serf',\n",
+ " 'shook',\n",
+ " 'spottiest',\n",
+ " 'stood',\n",
+ " 'surtaxing',\n",
+ " 'wardrobes']"
]
},
- "execution_count": 84,
+ "execution_count": 57,
"metadata": {},
"output_type": "execute_result"
}
},
{
"cell_type": "code",
- "execution_count": 85,
+ "execution_count": 59,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "scrolled": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
- "*bravos Counter({'v': 1, 'b': 1, 'a': 1, 's': 1, 'o': 1, 'r': 1})\n",
- "*burlier Counter({'r': 2, 'b': 1, 'u': 1, 'l': 1, 'i': 1, 'e': 1})\n",
- "*decriminalisation Counter({'i': 4, 'n': 2, 'a': 2, 's': 1, 'l': 1, 'd': 1, 'e': 1, 'r': 1, 't': 1, 'm': 1, 'o': 1, 'c': 1})\n",
- "*differs Counter({'f': 2, 's': 1, 'i': 1, 'd': 1, 'e': 1, 'r': 1})\n",
- "*duelled Counter({'d': 2, 'e': 2, 'l': 2, 'u': 1})\n",
- "*duplicating Counter({'i': 2, 'g': 1, 'n': 1, 'a': 1, 'l': 1, 'd': 1, 't': 1, 'p': 1, 'u': 1, 'c': 1})\n",
- "*elaborates Counter({'a': 2, 'e': 2, 'b': 1, 's': 1, 'l': 1, 'o': 1, 'r': 1, 't': 1})\n",
- "*encirclement Counter({'e': 3, 'n': 2, 'c': 2, 'm': 1, 't': 1, 'l': 1, 'i': 1, 'r': 1})\n",
- "*facsimiled Counter({'i': 2, 's': 1, 'm': 1, 'a': 1, 'f': 1, 'l': 1, 'd': 1, 'e': 1, 'c': 1})\n",
- "*festers Counter({'s': 2, 'e': 2, 'f': 1, 'r': 1, 't': 1})\n",
- "*flickering Counter({'i': 2, 'g': 1, 'n': 1, 'f': 1, 'l': 1, 'e': 1, 'k': 1, 'r': 1, 'c': 1})\n",
- "*fusible Counter({'s': 1, 'e': 1, 'f': 1, 'b': 1, 'i': 1, 'l': 1, 'u': 1})\n",
- "*interpolations Counter({'n': 2, 'i': 2, 'o': 2, 't': 2, 's': 1, 'a': 1, 'l': 1, 'e': 1, 'p': 1, 'r': 1})\n",
- "*involved Counter({'v': 2, 'n': 1, 'l': 1, 'i': 1, 'o': 1, 'e': 1, 'd': 1})\n",
- "*lithographed Counter({'h': 2, 'g': 1, 'a': 1, 'r': 1, 'l': 1, 'i': 1, 'o': 1, 'e': 1, 'p': 1, 'd': 1, 't': 1})\n",
- "*oblongs Counter({'o': 2, 'b': 1, 'g': 1, 'n': 1, 'l': 1, 's': 1})\n",
- "*overstates Counter({'s': 2, 'e': 2, 't': 2, 'v': 1, 'a': 1, 'o': 1, 'r': 1})\n",
- "*rallies Counter({'l': 2, 's': 1, 'a': 1, 'i': 1, 'e': 1, 'r': 1})\n",
- "*rebated Counter({'e': 2, 'b': 1, 'a': 1, 'd': 1, 'r': 1, 't': 1})\n",
- "*reneges Counter({'e': 3, 's': 1, 'g': 1, 'n': 1, 'r': 1})\n",
- "saleswomen Counter({'s': 2, 'e': 2, 'm': 1, 'n': 1, 'a': 1, 'l': 1, 'o': 1, 'w': 1})\n",
- "*slobbering Counter({'b': 2, 's': 1, 'g': 1, 'n': 1, 'i': 1, 'o': 1, 'e': 1, 'l': 1, 'r': 1})\n",
- "*toiletries Counter({'i': 2, 'e': 2, 't': 2, 's': 1, 'l': 1, 'o': 1, 'r': 1})\n",
- "*unabashed Counter({'a': 2, 'b': 1, 'n': 1, 'h': 1, 's': 1, 'd': 1, 'e': 1, 'u': 1})\n"
+ "ancestor Counter({'c': 1, 'a': 1, 's': 1, 't': 1, 'n': 1, 'r': 1, 'o': 1, 'e': 1})\n",
+ "baritone Counter({'a': 1, 'i': 1, 'r': 1, 't': 1, 'b': 1, 'n': 1, 'o': 1, 'e': 1})\n",
+ "bemusing Counter({'g': 1, 'u': 1, 'i': 1, 's': 1, 'n': 1, 'm': 1, 'b': 1, 'e': 1})\n",
+ "blonds Counter({'s': 1, 'd': 1, 'n': 1, 'b': 1, 'o': 1, 'l': 1})\n",
+ "conciseness Counter({'s': 3, 'c': 2, 'n': 2, 'e': 2, 'i': 1, 'o': 1})\n",
+ "consequent Counter({'n': 2, 'e': 2, 'u': 1, 'c': 1, 's': 1, 't': 1, 'q': 1, 'o': 1})\n",
+ "cuddle Counter({'d': 2, 'u': 1, 'e': 1, 'c': 1, 'l': 1})\n",
+ "dashboards Counter({'a': 2, 's': 2, 'd': 2, 'o': 1, 'r': 1, 'b': 1, 'h': 1})\n",
+ "*despairing Counter({'i': 2, 'g': 1, 'a': 1, 's': 1, 'r': 1, 'd': 1, 'n': 1, 'p': 1, 'e': 1})\n",
+ "dint Counter({'d': 1, 'n': 1, 'i': 1, 't': 1})\n",
+ "employer Counter({'e': 2, 'y': 1, 'r': 1, 'm': 1, 'p': 1, 'o': 1, 'l': 1})\n",
+ "freakish Counter({'k': 1, 'a': 1, 'i': 1, 'r': 1, 'f': 1, 's': 1, 'h': 1, 'e': 1})\n",
+ "*gall Counter({'l': 2, 'g': 1, 'a': 1})\n",
+ "hopelessness Counter({'s': 4, 'e': 3, 'h': 1, 'n': 1, 'p': 1, 'o': 1, 'l': 1})\n",
+ "*impales Counter({'s': 1, 'a': 1, 'i': 1, 'm': 1, 'e': 1, 'p': 1, 'l': 1})\n",
+ "infix Counter({'i': 2, 'f': 1, 'n': 1, 'x': 1})\n",
+ "inflow Counter({'i': 1, 'w': 1, 'f': 1, 'n': 1, 'o': 1, 'l': 1})\n",
+ "innumerable Counter({'n': 2, 'e': 2, 'u': 1, 'l': 1, 'a': 1, 'i': 1, 'r': 1, 'm': 1, 'b': 1})\n",
+ "intentional Counter({'n': 3, 'i': 2, 't': 2, 'a': 1, 'l': 1, 'o': 1, 'e': 1})\n",
+ "*jerkin Counter({'k': 1, 'i': 1, 'r': 1, 'n': 1, 'j': 1, 'e': 1})\n",
+ "justification Counter({'i': 3, 't': 2, 'u': 1, 'c': 1, 's': 1, 'n': 1, 'f': 1, 'j': 1, 'o': 1, 'a': 1})\n",
+ "leaving Counter({'g': 1, 'l': 1, 'a': 1, 'i': 1, 'n': 1, 'v': 1, 'e': 1})\n",
+ "locoweeds Counter({'o': 2, 'e': 2, 'c': 1, 's': 1, 'd': 1, 'w': 1, 'l': 1})\n",
+ "monickers Counter({'k': 1, 'c': 1, 's': 1, 'i': 1, 'r': 1, 'n': 1, 'm': 1, 'o': 1, 'e': 1})\n",
+ "originality Counter({'i': 3, 'g': 1, 'a': 1, 'r': 1, 't': 1, 'n': 1, 'y': 1, 'o': 1, 'l': 1})\n",
+ "outings Counter({'g': 1, 'u': 1, 's': 1, 'i': 1, 't': 1, 'n': 1, 'o': 1})\n",
+ "pendulous Counter({'u': 2, 's': 1, 'd': 1, 'n': 1, 'l': 1, 'p': 1, 'o': 1, 'e': 1})\n",
+ "pithier Counter({'i': 2, 'r': 1, 't': 1, 'p': 1, 'h': 1, 'e': 1})\n",
+ "randomness Counter({'s': 2, 'n': 2, 'a': 1, 'r': 1, 'd': 1, 'm': 1, 'o': 1, 'e': 1})\n",
+ "rectors Counter({'r': 2, 'c': 1, 's': 1, 't': 1, 'o': 1, 'e': 1})\n",
+ "redrew Counter({'e': 2, 'r': 2, 'd': 1, 'w': 1})\n",
+ "reformulated Counter({'r': 2, 'e': 2, 'u': 1, 'a': 1, 'f': 1, 't': 1, 'm': 1, 'l': 1, 'd': 1, 'o': 1})\n",
+ "remoteness Counter({'e': 3, 's': 2, 'r': 1, 't': 1, 'm': 1, 'n': 1, 'o': 1})\n",
+ "rethink Counter({'k': 1, 'i': 1, 'r': 1, 't': 1, 'n': 1, 'h': 1, 'e': 1})\n",
+ "scowls Counter({'s': 2, 'w': 1, 'c': 1, 'o': 1, 'l': 1})\n",
+ "sequencers Counter({'e': 3, 's': 2, 'u': 1, 'c': 1, 'r': 1, 'n': 1, 'q': 1})\n",
+ "serf Counter({'f': 1, 'r': 1, 's': 1, 'e': 1})\n",
+ "shook Counter({'o': 2, 'k': 1, 'h': 1, 's': 1})\n",
+ "spottiest Counter({'t': 3, 's': 2, 'i': 1, 'p': 1, 'o': 1, 'e': 1})\n",
+ "stood Counter({'o': 2, 'd': 1, 't': 1, 's': 1})\n",
+ "surtaxing Counter({'i': 1, 'u': 1, 'x': 1, 'g': 1, 'a': 1, 's': 1, 'r': 1, 't': 1, 'n': 1})\n",
+ "wardrobes Counter({'r': 2, 'a': 1, 's': 1, 'd': 1, 'w': 1, 'b': 1, 'o': 1, 'e': 1})\n"
]
}
],
"makeable_words = []\n",
"for w in unused_words:\n",
" unused_word_count = collections.Counter(w)\n",
- " if all(l in unused_letter_count and unused_word_count[l] <= unused_letter_count[l] for l in unused_word_count):\n",
+ " if all(unused_word_count[l] <= unused_letter_count[l] for l in unused_word_count):\n",
" makeable_words += [w]\n",
" print('*', end='')\n",
" print(w, unused_word_count)"
},
{
"cell_type": "code",
- "execution_count": 86,
+ "execution_count": 48,
"metadata": {
"collapsed": false
},
{
"data": {
"text/plain": [
- "17"
+ "10"
]
},
- "execution_count": 86,
+ "execution_count": 48,
"metadata": {},
"output_type": "execute_result"
}
},
{
"cell_type": "code",
- "execution_count": 90,
+ "execution_count": 49,
"metadata": {
"collapsed": false
},
{
"data": {
"text/plain": [
- "'decriminalisation'"
+ "'despairing'"
]
},
- "execution_count": 90,
+ "execution_count": 49,
"metadata": {},
"output_type": "execute_result"
}
},
{
"cell_type": "code",
- "execution_count": 103,
+ "execution_count": 74,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
- "def do_wordsearch_tasks(fn):\n",
+ "def do_wordsearch_tasks(fn, show_anyway=False):\n",
" width, height, grid, words = read_wordsearch(fn)\n",
+ " used_words = [w for w in words if present(grid, w)[0]]\n",
" unused_words = [w for w in words if not present(grid, w)[0]]\n",
" lwp = sorted([w for w in words if present(grid, w)[0]], key=len)[-1]\n",
+ " lwps = [w for w in used_words if len(w) == len(lwp)]\n",
" lwa = sorted(unused_words, key=len)[-1]\n",
+ " lwas = [w for w in unused_words if len(w) == len(lwa)]\n",
" g0 = empty_grid(width, height)\n",
" for w in words:\n",
" p, r, c, d = present(grid, w)\n",
" makeable_words = []\n",
" for w in unused_words:\n",
" unused_word_count = collections.Counter(w)\n",
- " if all(l in unused_letter_count and unused_word_count[l] <= unused_letter_count[l] for l in unused_word_count):\n",
+ " if all(unused_word_count[l] <= unused_letter_count[l] for l in unused_word_count):\n",
" makeable_words += [w]\n",
" lwm = sorted(makeable_words, key=len)[-1]\n",
- " print('\\n{}'.format(fn))\n",
- " print('Longest word present: {}, {} letters'.format(lwp, len(lwp)))\n",
- " print('Longest word absent: {}, {} letters'.format(lwa, len(lwa)))\n",
- " print('{} unused letters'.format(len([c for c in cat(cat(l) for l in g0) if c == '.'])))\n",
- " print('Longest makeable word: {}, {}'.format(lwm, len(lwm)))"
+ " lwms = [w for w in makeable_words if len(w) == len(lwm)]\n",
+ " if show_anyway or len(set((len(lwp),len(lwa),len(lwm)))) == 3:\n",
+ " print('\\n{}'.format(fn))\n",
+ " print('{} words present'.format(len(words) - len(unused_words)))\n",
+ " print('Longest word present: {}, {} letters ({})'.format(lwp, len(lwp), lwps))\n",
+ " print('Longest word absent: {}, {} letters ({})'.format(lwa, len(lwa), lwas))\n",
+ " print('{} unused letters'.format(len([c for c in cat(cat(l) for l in g0) if c == '.'])))\n",
+ " print('Longest makeable word: {}, {} ({})'.format(lwm, len(lwm), lwms))"
]
},
{
"cell_type": "code",
- "execution_count": 112,
+ "execution_count": 75,
"metadata": {
"collapsed": false
},
"name": "stdout",
"output_type": "stream",
"text": [
- "\n",
- "wordsearch00.txt\n",
- "Longest word present: yellowing, 9 letters\n",
- "Longest word absent: sequined, 8 letters\n",
- "147 unused letters\n",
- "Longest makeable word: pettiest, 8\n",
- "\n",
- "wordsearch01.txt\n",
- "Longest word present: soubriquets, 11 letters\n",
- "Longest word absent: swallowing, 10 letters\n",
- "124 unused letters\n",
- "Longest makeable word: extradited, 10\n",
- "\n",
- "wordsearch02.txt\n",
- "Longest word present: unattended, 10 letters\n",
- "Longest word absent: runabouts, 9 letters\n",
- "120 unused letters\n",
- "Longest makeable word: runabouts, 9\n",
- "\n",
- "wordsearch03.txt\n",
- "Longest word present: indemnifications, 16 letters\n",
- "Longest word absent: propagandised, 13 letters\n",
- "129 unused letters\n",
- "Longest makeable word: propagandised, 13\n",
"\n",
"wordsearch04.txt\n",
- "Longest word present: ostentatiously, 14 letters\n",
- "Longest word absent: oleomargarine, 13 letters\n",
- "128 unused letters\n",
- "Longest makeable word: oleomargarine, 13\n",
- "\n",
- "wordsearch05.txt\n",
- "Longest word present: straightjacketing, 17 letters\n",
- "Longest word absent: grandiloquence, 14 letters\n",
- "115 unused letters\n",
- "Longest makeable word: multivitamins, 13\n",
- "\n",
- "wordsearch06.txt\n",
- "Longest word present: inflorescence, 13 letters\n",
- "Longest word absent: extinguished, 12 letters\n",
- "159 unused letters\n",
- "Longest makeable word: convocations, 12\n",
- "\n",
- "wordsearch07.txt\n",
- "Longest word present: hypothesising, 13 letters\n",
- "Longest word absent: nonrenewable, 12 letters\n",
- "127 unused letters\n",
- "Longest makeable word: nonrenewable, 12\n",
+ "58 words present\n",
+ "Longest word present: fortification, 13 letters (['fortification'])\n",
+ "Longest word absent: justification, 13 letters (['justification'])\n",
+ "57 unused letters\n",
+ "Longest makeable word: despairing, 10 (['despairing'])\n"
+ ]
+ }
+ ],
+ "source": [
+ "do_wordsearch_tasks('wordsearch04.txt', show_anyway=True)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 70,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
"\n",
"wordsearch08.txt\n",
- "Longest word present: misrepresents, 13 letters\n",
- "Longest word absent: predominates, 12 letters\n",
- "125 unused letters\n",
- "Longest makeable word: predominates, 12\n",
- "\n",
- "wordsearch09.txt\n",
- "Longest word present: counterattacks, 14 letters\n",
- "Longest word absent: overstepping, 12 letters\n",
- "125 unused letters\n",
- "Longest makeable word: constituents, 12\n",
- "\n",
- "wordsearch10.txt\n",
- "Longest word present: cheerlessness, 13 letters\n",
- "Longest word absent: gregariously, 12 letters\n",
- "142 unused letters\n",
- "Longest makeable word: gregariously, 12\n",
- "\n",
- "wordsearch11.txt\n",
- "Longest word present: petitioners, 11 letters\n",
- "Longest word absent: overdosing, 10 letters\n",
- "137 unused letters\n",
- "Longest makeable word: needlessly, 10\n",
- "\n",
- "wordsearch12.txt\n",
- "Longest word present: propagandises, 13 letters\n",
- "Longest word absent: fluorescent, 11 letters\n",
- "130 unused letters\n",
- "Longest makeable word: fluorescent, 11\n",
+ "62 words present\n",
+ "Longest word present: compassionately, 15 letters (['compassionately'])\n",
+ "Longest word absent: retrospectives, 14 letters (['retrospectives'])\n",
+ "65 unused letters\n",
+ "Longest makeable word: vacationing, 11 (['vacationing'])\n"
+ ]
+ }
+ ],
+ "source": [
+ "do_wordsearch_tasks('wordsearch08.txt')"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 76,
+ "metadata": {
+ "collapsed": false,
+ "scrolled": true
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
"\n",
- "wordsearch13.txt\n",
- "Longest word present: preregisters, 12 letters\n",
- "Longest word absent: undergrowth, 11 letters\n",
- "113 unused letters\n",
- "Longest makeable word: undergrowth, 11\n",
+ "wordsearch08.txt\n",
+ "62 words present\n",
+ "Longest word present: compassionately, 15 letters (['compassionately'])\n",
+ "Longest word absent: retrospectives, 14 letters (['retrospectives'])\n",
+ "65 unused letters\n",
+ "Longest makeable word: vacationing, 11 (['vacationing'])\n",
"\n",
- "wordsearch14.txt\n",
- "Longest word present: dispossessing, 13 letters\n",
- "Longest word absent: sweatshirts, 11 letters\n",
- "116 unused letters\n",
- "Longest makeable word: sweatshirts, 11\n",
+ "wordsearch17.txt\n",
+ "58 words present\n",
+ "Longest word present: complementing, 13 letters (['complementing'])\n",
+ "Longest word absent: upholstering, 12 letters (['domestically', 'upholstering'])\n",
+ "56 unused letters\n",
+ "Longest makeable word: plunderer, 9 (['plunderer'])\n",
"\n",
- "wordsearch15.txt\n",
- "Longest word present: retrenching, 11 letters\n",
- "Longest word absent: quadruples, 10 letters\n",
- "119 unused letters\n",
- "Longest makeable word: cavillings, 10\n",
+ "wordsearch32.txt\n",
+ "60 words present\n",
+ "Longest word present: reciprocating, 13 letters (['reciprocating'])\n",
+ "Longest word absent: parenthesise, 12 letters (['collectibles', 'frontrunners', 'parenthesise'])\n",
+ "65 unused letters\n",
+ "Longest makeable word: sultanas, 8 (['sultanas'])\n",
"\n",
- "wordsearch16.txt\n",
- "Longest word present: cantankerously, 14 letters\n",
- "Longest word absent: amorphousness, 13 letters\n",
- "101 unused letters\n",
- "Longest makeable word: amorphousness, 13\n",
+ "wordsearch52.txt\n",
+ "51 words present\n",
+ "Longest word present: prefabricated, 13 letters (['prefabricated'])\n",
+ "Longest word absent: catastrophic, 12 letters (['capitalistic', 'catastrophic'])\n",
+ "86 unused letters\n",
+ "Longest makeable word: unimpressed, 11 (['bloodstream', 'brainstorms', 'reassembles', 'rhapsodises', 'synergistic', 'unimpressed'])\n",
"\n",
- "wordsearch17.txt\n",
- "Longest word present: appreciating, 12 letters\n",
- "Longest word absent: unreasoning, 11 letters\n",
- "114 unused letters\n",
- "Longest makeable word: unreasoning, 11\n",
+ "wordsearch62.txt\n",
+ "58 words present\n",
+ "Longest word present: diametrically, 13 letters (['diametrically'])\n",
+ "Longest word absent: streetlights, 12 letters (['harmonically', 'skyrocketing', 'streetlights'])\n",
+ "59 unused letters\n",
+ "Longest makeable word: tabernacle, 10 (['falterings', 'tabernacle'])\n",
"\n",
- "wordsearch18.txt\n",
- "Longest word present: rehabilitates, 13 letters\n",
- "Longest word absent: interlarding, 12 letters\n",
- "135 unused letters\n",
- "Longest makeable word: interlarding, 12\n",
+ "wordsearch76.txt\n",
+ "60 words present\n",
+ "Longest word present: bloodthirstier, 14 letters (['bloodthirstier'])\n",
+ "Longest word absent: incriminating, 13 letters (['incriminating'])\n",
+ "59 unused letters\n",
+ "Longest makeable word: stubbornly, 10 (['leafletted', 'stubbornly'])\n",
"\n",
- "wordsearch19.txt\n",
- "Longest word present: predetermines, 13 letters\n",
- "Longest word absent: prosperously, 12 letters\n",
- "127 unused letters\n",
- "Longest makeable word: kneecapping, 11\n"
+ "wordsearch94.txt\n",
+ "59 words present\n",
+ "Longest word present: unforgettable, 13 letters (['unforgettable'])\n",
+ "Longest word absent: accommodated, 12 letters (['accommodated'])\n",
+ "69 unused letters\n",
+ "Longest makeable word: respectably, 11 (['predictions', 'respectably'])\n"
]
}
],
" do_wordsearch_tasks(fn)"
]
},
+ {
+ "cell_type": "code",
+ "execution_count": 38,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "absolved (True, 16, 2, <Direction.right: 2>)\n",
+ "adorable (True, 11, 4, <Direction.right: 2>)\n",
+ "aeon (True, 11, 4, <Direction.down: 4>)\n",
+ "alias (True, 15, 15, <Direction.left: 1>)\n",
+ "ancestor (False, 0, 0, <Direction.left: 1>)\n",
+ "baritone (False, 0, 0, <Direction.left: 1>)\n",
+ "bemusing (False, 0, 0, <Direction.left: 1>)\n",
+ "blonds (False, 0, 0, <Direction.left: 1>)\n",
+ "bran (True, 1, 9, <Direction.left: 1>)\n",
+ "calcite (True, 19, 9, <Direction.upright: 6>)\n",
+ "candor (True, 17, 12, <Direction.right: 2>)\n",
+ "conciseness (False, 0, 0, <Direction.left: 1>)\n",
+ "consequent (False, 0, 0, <Direction.left: 1>)\n",
+ "cuddle (False, 0, 0, <Direction.left: 1>)\n",
+ "damming (True, 17, 2, <Direction.right: 2>)\n",
+ "dashboards (False, 0, 0, <Direction.left: 1>)\n",
+ "despairing (False, 0, 0, <Direction.left: 1>)\n",
+ "dint (False, 0, 0, <Direction.left: 1>)\n",
+ "dullard (True, 8, 2, <Direction.down: 4>)\n",
+ "dynasty (True, 3, 4, <Direction.downright: 8>)\n",
+ "employer (False, 0, 0, <Direction.left: 1>)\n",
+ "exhorts (True, 0, 8, <Direction.left: 1>)\n",
+ "feted (True, 5, 10, <Direction.right: 2>)\n",
+ "fill (True, 9, 14, <Direction.upleft: 5>)\n",
+ "flattens (True, 10, 10, <Direction.upleft: 5>)\n",
+ "foghorn (True, 10, 11, <Direction.downright: 8>)\n",
+ "fortification (True, 19, 16, <Direction.left: 1>)\n",
+ "freakish (False, 0, 0, <Direction.left: 1>)\n",
+ "frolics (True, 16, 16, <Direction.up: 3>)\n",
+ "gall (False, 0, 0, <Direction.left: 1>)\n",
+ "gees (True, 17, 0, <Direction.upright: 6>)\n",
+ "genies (True, 5, 7, <Direction.upleft: 5>)\n",
+ "gets (True, 6, 4, <Direction.upleft: 5>)\n",
+ "hastening (True, 14, 13, <Direction.left: 1>)\n",
+ "hits (True, 2, 0, <Direction.down: 4>)\n",
+ "hopelessness (False, 0, 0, <Direction.left: 1>)\n",
+ "hurlers (True, 18, 0, <Direction.right: 2>)\n",
+ "impales (False, 0, 0, <Direction.left: 1>)\n",
+ "infix (False, 0, 0, <Direction.left: 1>)\n",
+ "inflow (False, 0, 0, <Direction.left: 1>)\n",
+ "innumerable (False, 0, 0, <Direction.left: 1>)\n",
+ "intentional (False, 0, 0, <Direction.left: 1>)\n",
+ "jerkin (False, 0, 0, <Direction.left: 1>)\n",
+ "justification (False, 0, 0, <Direction.left: 1>)\n",
+ "kitty (True, 8, 15, <Direction.upleft: 5>)\n",
+ "knuckles (True, 17, 19, <Direction.up: 3>)\n",
+ "leaving (False, 0, 0, <Direction.left: 1>)\n",
+ "like (True, 3, 11, <Direction.left: 1>)\n",
+ "limitation (True, 8, 3, <Direction.right: 2>)\n",
+ "locoweeds (False, 0, 0, <Direction.left: 1>)\n",
+ "loot (True, 3, 19, <Direction.up: 3>)\n",
+ "lucking (True, 7, 10, <Direction.upleft: 5>)\n",
+ "lumps (True, 0, 17, <Direction.down: 4>)\n",
+ "mercerising (True, 15, 17, <Direction.up: 3>)\n",
+ "monickers (False, 0, 0, <Direction.left: 1>)\n",
+ "motionless (True, 13, 1, <Direction.up: 3>)\n",
+ "naturally (True, 9, 16, <Direction.up: 3>)\n",
+ "nighest (True, 15, 4, <Direction.right: 2>)\n",
+ "notion (True, 17, 18, <Direction.up: 3>)\n",
+ "ogled (True, 1, 18, <Direction.down: 4>)\n",
+ "originality (False, 0, 0, <Direction.left: 1>)\n",
+ "outings (False, 0, 0, <Direction.left: 1>)\n",
+ "pendulous (False, 0, 0, <Direction.left: 1>)\n",
+ "piled (True, 1, 10, <Direction.right: 2>)\n",
+ "pins (True, 7, 4, <Direction.upleft: 5>)\n",
+ "pithier (False, 0, 0, <Direction.left: 1>)\n",
+ "prep (True, 10, 4, <Direction.right: 2>)\n",
+ "randomness (False, 0, 0, <Direction.left: 1>)\n",
+ "rectors (False, 0, 0, <Direction.left: 1>)\n",
+ "redrew (False, 0, 0, <Direction.left: 1>)\n",
+ "reformulated (False, 0, 0, <Direction.left: 1>)\n",
+ "remoteness (False, 0, 0, <Direction.left: 1>)\n",
+ "retaking (True, 6, 0, <Direction.down: 4>)\n",
+ "rethink (False, 0, 0, <Direction.left: 1>)\n",
+ "rope (True, 9, 4, <Direction.right: 2>)\n",
+ "rubier (True, 0, 4, <Direction.downright: 8>)\n",
+ "sailors (True, 7, 15, <Direction.up: 3>)\n",
+ "scowls (False, 0, 0, <Direction.left: 1>)\n",
+ "scum (True, 16, 11, <Direction.right: 2>)\n",
+ "sepals (True, 6, 10, <Direction.upright: 6>)\n",
+ "sequencers (False, 0, 0, <Direction.left: 1>)\n",
+ "serf (False, 0, 0, <Direction.left: 1>)\n",
+ "shoaled (True, 11, 18, <Direction.up: 3>)\n",
+ "shook (False, 0, 0, <Direction.left: 1>)\n",
+ "sonic (True, 18, 18, <Direction.left: 1>)\n",
+ "spottiest (False, 0, 0, <Direction.left: 1>)\n",
+ "stag (True, 7, 8, <Direction.left: 1>)\n",
+ "stood (False, 0, 0, <Direction.left: 1>)\n",
+ "stratum (True, 2, 13, <Direction.left: 1>)\n",
+ "strong (True, 4, 19, <Direction.down: 4>)\n",
+ "studying (True, 0, 16, <Direction.left: 1>)\n",
+ "surtaxing (False, 0, 0, <Direction.left: 1>)\n",
+ "tailing (True, 13, 6, <Direction.right: 2>)\n",
+ "tears (True, 13, 3, <Direction.up: 3>)\n",
+ "teazles (True, 4, 10, <Direction.downright: 8>)\n",
+ "vans (True, 18, 8, <Direction.upright: 6>)\n",
+ "wardrobes (False, 0, 0, <Direction.left: 1>)\n",
+ "wooded (True, 12, 5, <Direction.right: 2>)\n",
+ "worsts (True, 1, 0, <Direction.downright: 8>)\n",
+ "zings (True, 10, 14, <Direction.upleft: 5>)\n"
+ ]
+ }
+ ],
+ "source": [
+ "width, height, grid, words = read_wordsearch('wordsearch04.txt')\n",
+ "for w in words:\n",
+ " print(w, present(grid, w))"
+ ]
+ },
{
"cell_type": "code",
"execution_count": null,