Removal of random 'Words' in wordle. Removed solvers.

Signed-off-by: adithyagenie <adithyagenie@gmail.com>
This commit is contained in:
adithyagenie 2023-07-29 20:29:06 +05:30
parent 690abbd798
commit ee9134bfb5
4 changed files with 1 additions and 128 deletions

View file

@ -1 +1,2 @@
windows-curses windows-curses
mysql-connector-python

View file

@ -1,54 +0,0 @@
words = open("words.txt").read().split("\n")
def partition(word, words):
# Get how many words will remain for each possible response
partitions = []
for a in "MCW":
for b in "MCW":
for c in "MCW":
for d in "MCW":
for e in "MCW":
partitions.append(len(reduce(word, a + b + c + d + e, words)))
return partitions
def reduce(word, result, words):
# word: 5-letter word (lowercase)
# result: 5-letter str consisting of M, C, W (misplaced, correct, wrong)
res = words[:]
for i, s in enumerate(result):
nres = []
for w in res:
if s == "M":
if w[i] != word[i] and word[i] in w:
nres.append(w)
if s == "C":
if w[i] == word[i]:
nres.append(w)
if s == "W":
if w[i] != word[i]:
if not (word[i] in w) or word.count(word[i]) > 1:
nres.append(w)
res = nres
return res
print("WORDLE SOLVER")
print("=============")
# First guess is precomputed
opt = "crate"
result = ""
while result != "CCCCC":
print(opt)
result = input("> ").upper()
words = reduce(opt, result, words)
opt = ""
opt_size = float("inf")
for word in words:
p = partition(word, words)
avg_partition_size = sum(p) / len(p)
if opt_size > avg_partition_size:
opt_size = avg_partition_size
opt = word
# print(p)

View file

@ -1,53 +0,0 @@
words = open("wordle\\words.txt").read().split()
guesslist = []
maxguesses = 6
wantedletters = []
uselessletters = []
correctletters = ["-"] * 5
while maxguesses:
try:
correctguess = input(
"\nEnter correct letter positions (use - for other letters): "
).lower()
uselessguess = input("Enter all incorrect letters without space: ").lower()
wantedguess = input("Enter all letters of incorrect postiions: ").lower()
correctletters = list(correctguess)
for i in uselessguess:
if i not in uselessletters:
uselessletters.append(i)
for i in wantedguess:
if i not in wantedletters:
wantedletters.append(i)
subsetwanted = []
for i in words:
if set(wantedletters).issubset(set(i)):
subsetwanted.append(i)
print("First filter", subsetwanted)
for i in uselessletters:
for j in subsetwanted:
if j.count(i):
subsetwanted.remove(j)
print("Second filter: ", subsetwanted)
print(correctletters)
temp = []
for i in range(len(correctletters)):
for j in range(len(subsetwanted)):
if correctletters[i] == "-":
continue
else:
print(i, j, correctletters[i], subsetwanted[j][i])
if correctletters[i] == subsetwanted[j][i]:
temp.append(subsetwanted[j])
subsetwanted = temp.copy()
print("Third filter: ", subsetwanted)
except KeyboardInterrupt:
print("\n\nThe word was found!")
break
maxguesses -= 1

View file

@ -138,7 +138,6 @@ axial
axiom axiom
axion axion
azure azure
Words
bacon bacon
badge badge
badly badly
@ -312,7 +311,6 @@ butte
buxom buxom
buyer buyer
bylaw bylaw
Words
cabal cabal
cabby cabby
cabin cabin
@ -511,7 +509,6 @@ cutie
cyber cyber
cycle cycle
cynic cynic
Words
daddy daddy
daily daily
dairy dairy
@ -623,7 +620,6 @@ dwarf
dwell dwell
dwelt dwelt
dying dying
Words
eager eager
eagle eagle
early early
@ -696,7 +692,6 @@ extol
extra extra
exult exult
eying eying
Words
fable fable
facet facet
faint faint
@ -832,7 +827,6 @@ furor
furry furry
fussy fussy
fuzzy fuzzy
Words
gaffe gaffe
gaily gaily
gamer gamer
@ -948,7 +942,6 @@ guppy
gusto gusto
gusty gusty
gypsy gypsy
Words
habit habit
hairy hairy
halve halve
@ -1018,7 +1011,6 @@ hydro
hyena hyena
hymen hymen
hyper hyper
Words
icily icily
icing icing
ideal ideal
@ -1053,7 +1045,6 @@ islet
issue issue
itchy itchy
ivory ivory
Words
jaunt jaunt
jazzy jazzy
jelly jelly
@ -1074,7 +1065,6 @@ jumpy
junta junta
junto junto
juror juror
Words
kappa kappa
karma karma
kayak kayak
@ -1095,7 +1085,6 @@ knoll
known known
koala koala
krill krill
Words
label label
labor labor
laden laden
@ -1183,7 +1172,6 @@ lusty
lying lying
lymph lymph
lyric lyric
Words
macaw macaw
macho macho
macro macro
@ -1291,7 +1279,6 @@ music
musky musky
musty musty
myrrh myrrh
Words
nadir nadir
naive naive
nanny nanny
@ -1329,7 +1316,6 @@ nurse
nutty nutty
nylon nylon
nymph nymph
Words
oaken oaken
obese obese
occur occur
@ -1371,7 +1357,6 @@ owing
owner owner
oxide oxide
ozone ozone
Words
paddy paddy
pagan pagan
paint paint
@ -1513,7 +1498,6 @@ purse
pushy pushy
putty putty
pygmy pygmy
Words
quack quack
quail quail
quake quake
@ -1537,7 +1521,6 @@ quite
quota quota
quote quote
quoth quoth
Words
rabbi rabbi
rabid rabid
racer racer
@ -1643,7 +1626,6 @@ rumor
rupee rupee
rural rural
rusty rusty
Words
sadly sadly
safer safer
saint saint
@ -2009,7 +1991,6 @@ sworn
swung swung
synod synod
syrup syrup
Words
tabby tabby
table table
taboo taboo
@ -2159,7 +2140,6 @@ twirl
twist twist
twixt twixt
tying tying
Words
udder udder
ulcer ulcer
ultra ultra
@ -2193,7 +2173,6 @@ usual
usurp usurp
utile utile
utter utter
Words
vague vague
valet valet
valid valid