diff --git a/__pycache__/prob.cpython-39.pyc b/__pycache__/prob.cpython-39.pyc new file mode 100644 index 0000000..5457ced Binary files /dev/null and b/__pycache__/prob.cpython-39.pyc differ 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")