From 6147018add2703b9b7c2d68872591891226e7bdc Mon Sep 17 00:00:00 2001 From: Islem Maboud Date: Mon, 7 Feb 2022 23:48:44 +0100 Subject: [PATCH] Remove unused script --- wordle.py | 66 ------------------------------------------------------- 1 file changed, 66 deletions(-) delete mode 100644 wordle.py diff --git a/wordle.py b/wordle.py deleted file mode 100644 index 139de41..0000000 --- a/wordle.py +++ /dev/null @@ -1,66 +0,0 @@ -f = open("words.txt","r") -all_w = open("words.txt","r") - -lines = f.readlines() -all_lines = all_w.readlines() - - -count = 0 - -from functools import lru_cache - -@lru_cache(maxsize=None) -def calc_response_vector(w1,w2): - tw2 = w2 - msum = [0 for i in range(5)] - for c_ind in range(5): - if w1[c_ind] == tw2[c_ind]: - msum[c_ind] = 2 - tw2 = tw2[:c_ind] + "*" + tw2[c_ind+1:] - for c_ind in range(5): - if w1[c_ind] in tw2 and msum[c_ind] == 0: - msum[c_ind] = 1 - ind_app = tw2.find(w1[c_ind]) - tw2 = tw2[:ind_app] + "*" + tw2[ind_app+1:] - return msum - - - -for round in range(6): - min_wc = 100000 - chosen_word = "" - srmat = {} - if round != 0: - all_it = all_lines - else: - all_it = ["aesir"] - - for w1 in all_it: - w1 = w1.strip() - mat = {} - rmat = {} - for w2 in lines: - w2 = w2.strip() - msum = calc_response_vector(w1,w2) - if tuple(msum) not in rmat: - rmat[tuple(msum)] = [w2] - else: - rmat[tuple(msum)].append(w2) - mat[tuple([w1,w2])] = msum - - M = max([len(val) for val in rmat.values()]) - if M < min_wc: - min_wc = M - chosen_word = w1 - srmat = rmat - - print(chosen_word) - inp = input() - feedback = tuple([int(el) for el in inp.split(",")]) - lines = srmat[feedback] - if len(lines) == 1: - print("Done. Final word is {}".format(lines[0])) - exit(0) - -print("Failed. Did not find word after 6 attempts") -