zikato / blogcomments

0 stars 0 forks source link

SQL Wordle Series - Part Two: Playing - StraightforwardSQL #12

Open utterances-bot opened 2 years ago

utterances-bot commented 2 years ago

SQL Wordle Series - Part Two: Playing - StraightforwardSQL

In previous blog post I've shown you how to cheat. This time we'll learn how to play and score our guesses using TSQL.

https://straightforwardsql.com/posts/sql-wordle-series-playing/

Madhangi-FTI commented 2 years ago

Hi Tom... Very nice..

I am also trying to do what you are doing. Happy to see you are using similar approach that you split the words into letters and using that as table. The other one I saw was using denormalized form...

My idea for "how to calculate the optimal guesses" --> I am thinking of a multi step approach.

  1. How representative this word is of the population:
    a. How many words have the same letter in the same place? b. How many words have the same letter in a different place?

if you could compute a numeric value that represents these facts that would give you the best word that would help you make the best choice among the possible words.

I will write the formula and try to upload that as a picture.

And the formula should be weighted in the sense, if it is in the same place it is best but if the letter is in any other place it is better. that distinction in weights.

  1. Words without the letters you have already tried: For example you could have realized that there is a C but not in which place. So you would not have eliminated all the words with C. But you don't want to try the C in multiple places. So al least in the first few tries if you can use new letters it would make it best.

  2. Number of vowels / consonants. I don't want to choose a word like Audio / adieu which most people use as their first letter, because you are exhausting all your options there. From next word you are forced to reuse the same letters, there by wasting your choices. When manually doing it I try to use "BREAK, POUND, MISTY, CIVIL" in that order so by fourth chance no matter what the word is I got few letters placed. That strategy had helped me solve 98% of the time, excepting where I really did not know the word. But how I bring it in code, I am still thinking.

Thank you for writing this post. I loved it.

But, I did not read the solution fully, because I want to finish mine first. Then I will sure compare with yours. So if you have done any of this, please do share in words as I will read the code last.