add fancy data crunching function and help menu
This commit is contained in:
parent
2d58cb1cac
commit
e23268edfa
Binary file not shown.
31
prob.py
31
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):
|
def generateOutput(inputword, correct):
|
||||||
res = [0, 0, 0, 0, 0]
|
res = [0, 0, 0, 0, 0]
|
||||||
for i in range(len(inputword)):
|
for i in range(len(inputword)):
|
||||||
|
@ -22,15 +17,29 @@ def probs(dataset):
|
||||||
res[i] = 1
|
res[i] = 1
|
||||||
return res
|
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:
|
return buf
|
||||||
data[i] = None
|
|
||||||
|
def runtime(dataset):
|
||||||
|
return len(dataset) * len(dataset)
|
||||||
|
|
||||||
|
def main(words):
|
||||||
|
data = {}
|
||||||
|
|
||||||
|
for i in words:
|
||||||
cache = []
|
cache = []
|
||||||
for j in words:
|
for j in words:
|
||||||
cache.append(generateOutput(i, j))
|
cache.append(generateOutput(i, j))
|
||||||
print("cached {} {}".format(i, j))
|
|
||||||
data[i] = probs(cache)
|
data[i] = probs(cache)
|
||||||
|
|
||||||
fdtwo = open("dataoutput", "wb")
|
return dist(data)
|
||||||
pickle.dump(data, fdtwo)
|
|
||||||
|
|
17
solver.py
17
solver.py
|
@ -1,5 +1,7 @@
|
||||||
#!/usr/bin/python3
|
#!/usr/bin/python3
|
||||||
|
|
||||||
|
import prob
|
||||||
|
|
||||||
words = [i.rstrip() for i in open("wordlist", "r").readlines()]
|
words = [i.rstrip() for i in open("wordlist", "r").readlines()]
|
||||||
|
|
||||||
nocontain = []
|
nocontain = []
|
||||||
|
@ -58,6 +60,21 @@ while True:
|
||||||
words = buf
|
words = buf
|
||||||
elif line.split(' ')[0] == "listbuffers":
|
elif line.split(' ')[0] == "listbuffers":
|
||||||
print(nocontain, contains, defcontains)
|
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":
|
elif line.split(' ')[0] == "words":
|
||||||
print(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")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue