Wordle (an update)

def get_score_counts_for_each_guess(guesswords, words):
outer_results = {}
for guess in guesswords:
results = list(get_scores(guess, words).values())
outer_results[guess] = sum(results)/len(results)
return outer_results
  • If the word in BEATS and you guess SEATS, it won’t mark the first letter as yellow, as it has already confirmed that the final letter is S.
  • If you guess SEATS and the word is FEAST, it won’t mark both of your S’s as yellow, just the first one.
def score_word(guess, actual):
outcome = [0,0,0,0,0]
tempword = list(actual)
for i, c in enumerate(guess):
if tempword[i]==c:
outcome[i]=2
tempword[i]='0'
for i, c in enumerate(guess):
if c == 0:
if (c in tempword):
outcome[i]=1
tempword[tempword.index(c)] = '0'
return tuple(outcome)

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Guy Lipman

Guy Lipman

Fascinated by what makes societies and markets work, especially in sustainable energy. http://guylipman.com. Views not necessarily reflect those of my employer.