From e23268edfaee2027f99fa03f3e25cbf5de0ded83 Mon Sep 17 00:00:00 2001 From: randomuser Date: Tue, 8 Feb 2022 19:58:27 +0000 Subject: [PATCH] add fancy data crunching function and help menu --- __pycache__/prob.cpython-39.pyc | Bin 0 -> 1283 bytes prob.py | 39 ++++++++++++++++++++------------ solver.py | 17 ++++++++++++++ 3 files changed, 41 insertions(+), 15 deletions(-) create mode 100644 __pycache__/prob.cpython-39.pyc diff --git a/__pycache__/prob.cpython-39.pyc b/__pycache__/prob.cpython-39.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5457ced3f6fcefc5d4fb1a4a4441eebb35d1b438 GIT binary patch literal 1283 zcmZWoJ8K(35Z>9{lTNZ_j3bhj&i(h!*5gVK*+J^1=XQ|W}GT+C=j`{L8~ zROKR94UrS`Q)#!2%w?`x;;g=~d=|ED)I#fEpAp{E2T^bh$HLNMcFnO|vmsJNVB=9Q zDbyet6@kkpgCx@JN`ExT+?TO6?Q(Z)ZPImxvPoJ{|4P^jZvK7QJRT2|W|rD!ukV`t z?;ttqr^n5S9e1`S=fz4d86`G$$%o9r8^4#XfC&m|6sVeOfG+j0>7LXSK$fNTX zLSIaQ3J}?xa{h#zH-U)^L<6|(2ql0>Xoz(z za@C7~<4!r6bQw&LMw}t7$tqb6`(BJCD42YV9SFTejQdk*XsSROHIfaEdt(~pTuYqt zpdoeyDyxmeuFp1dx`YLG{ap0qPa>be2^nSdg)qT)XgH&&bTBU_r*$tF29Ha62ueA% z9I!NSw4BHs0V?S0JXx;ZJmau6h=&~$@4kTQ4@i7lH~rLYwFcvEJV2F%O88S1nu z?NjI<<;DqnpjRO{WH+NZuOr7RI*7<}zhL8N9==+(*~s;W$t&1WKZRr)kncUi_qj9t zGkXwjdTwhfQCn0Gb*!VN>XK(v=6W`-RUI>@W;ea(RF3Hd^v~cV()I~9-{QW9e11_- z1UxQjp}8qNa7ECKyT^%L=ihyWZp);Haewq0hX2!}W$1fzjaH=P(qYygJmC}cwmZ&l YJ%+8}*kprb*Uuz(Ojr#oVJ%eu0AQfu2><{9 literal 0 HcmV?d00001 diff --git a/prob.py b/prob.py index 3b2e0b7..1861e9d 100644 --- a/prob.py +++ b/prob.py @@ -1,8 +1,3 @@ -import pickle -fd = open("wordlist", "r") -words = [i.rstrip() for i in fd.readlines()] -print(words) - def generateOutput(inputword, correct): res = [0, 0, 0, 0, 0] for i in range(len(inputword)): @@ -22,15 +17,29 @@ def probs(dataset): res[i] = 1 return res -data = {} +def dist(dataset): + buf = [] + for i in dataset: + tot = 0 + nums = 0 + for j in dataset[i]: + tot += dataset[i][j] + nums += 1 + buf.append([i, tot / nums]) + buf.sort(key = lambda x: x[1]) -for i in words: - data[i] = None - cache = [] - for j in words: - cache.append(generateOutput(i, j)) - print("cached {} {}".format(i, j)) - data[i] = probs(cache) + return buf -fdtwo = open("dataoutput", "wb") -pickle.dump(data, fdtwo) +def runtime(dataset): + return len(dataset) * len(dataset) + +def main(words): + data = {} + + for i in words: + cache = [] + for j in words: + cache.append(generateOutput(i, j)) + data[i] = probs(cache) + + return dist(data) diff --git a/solver.py b/solver.py index bf078a0..304e495 100644 --- a/solver.py +++ b/solver.py @@ -1,5 +1,7 @@ #!/usr/bin/python3 +import prob + words = [i.rstrip() for i in open("wordlist", "r").readlines()] nocontain = [] @@ -58,6 +60,21 @@ while True: words = buf elif line.split(' ')[0] == "listbuffers": print(nocontain, contains, defcontains) + elif line.split(' ')[0] == "probmodel": + tmp = prob.main(words) + tmp.reverse() + print(tmp) + elif line.split(' ')[0] == "probruntime": + print(prob.runtime(words)) elif line.split(' ')[0] == "words": print(words) + elif line.split(' ')[0] == "help": + print("welcome to wordlefish, a 'engine' for wordle") + print("add - add pattern") + print("reduce - apply pattern filter") + print("listbuffers - list filters in buffers") + print("probmodel - output ordered arr based on expensive dist model") + print("probruntime - return iterations of probmodel") + print("words - list words in consideration") + print("help - this")