GillesVandewiele / Wordle-Bot

An entropy-based strategy to wordle
MIT License
27 stars 11 forks source link

add all_words and other update #4

Closed dawghen closed 2 years ago

dawghen commented 2 years ago

Add an all_word.txt file and let the bot use the entropy until the entropy gets too small. It helps to reduce over-rounded resolutions. Added option to choose initial guess ('tares' for every word) to reduce testing time. The average round is now around 4.12 for all 2315 solutions with 1 over-rounded solution (7 rounds)

next stage

  1. Use multi-processing to reduce processing time.
  2. Consider frequently used words using NLTK or other way
GillesVandewiele commented 2 years ago

This is great @dawghen. Thank you so much!!! I'm on holidays atm but will review and merge when I'm back!

We might have to consider using 2 files as well: 1 "full-blown" and 1 "minimal" one. The latter could be more useful for educational purposes.

With regards to the frequency, that could be a nice option when you let a human pick a word that the bot should guess. It won't help for Wordle though as they pick a word from the list (not so randomly) with uniform chances.

dawghen commented 2 years ago

"Entropy getting too small" in my first comment indicates that the singularity is at P = 0 (log P is infinite and Python yields p*log p = 0 instead. we can edit it.)

Thank you for your kind reply. Yes, we can make it more educational. In the early rounds, humans tend to choose words outside the letters they've already checked out. It can be said that the -log p is maximized, so humans and machines share the solving principle.

I thought about how the bot would solve all the words in 6 rounds and minimize the average round. As you already know, the entropy-only approach helps the former but also reduces the need to solve it in 2-3 rounds. (mostly solved at 4th round) The NLTK-only approach gives better averages (3.8), but often doesn't work out in round 6 (sometimes beyond rounds 8-9).

Properly combining the two approaches, the mean would be close to 3.6, but I don't know how to make the condition to combine them ideally.

GillesVandewiele commented 2 years ago

Sorry it took me so long, but I merged the code! Thank you so much once again for your contribution.