KX Community

Find answers, ask questions, and connect with our KX Community around the world.
KX Community Guidelines

Home Forums kdb+ Wordle kdb Re: Wordle kdb

  • pcarroll

    Member
    January 23, 2022 at 11:00 am

    Folks, I might need to add this to the JIRA board as it is now becoming priority numero uno, but I have an interesting Friday conclusion!

    1) So, last we left off, we had counted the letter usage in a given position, I decided to divide this by the number of words to assign scores to each letter in each position

    // some sanity checks 
    q)sum each letFreq 3145 3145 3145 3145 3145 
    q)count wordz 3145 // looks good 
    q)letScore:letFreq%3145 
    q)letScore 
    "sbcaptmdfglrehwkvnojiquyzx"!0.1383148 0.08426073 0.08330684 0.06868045 0.061.. 
    "aoeriluhntpywcmsdbgxvkfqzj"!0.1558029 0.1236884 0.117965 0.1033386 0.0848966.. 
    "aiorenlutsdgmbcpvywfkzhxjq"!0.1224165 0.1023847 0.0899841 0.08744038 0.07599.. 
    "eainrsctolugdmkpvfhbwzyxj"!0.1243243 0.08139905 0.07980922 0.07567568 0.0705.. 
    "eytnlrhasdkopmcgifxwbzuv"!0.1799682 0.1357711 0.09189189 0.08076312 0.062957..
    I feel like this makes senses as an e in position five should be more valuable based on frequency than an a in position three. Although I might be putting the  in front of the .
    2) I then compared all the 5 letter words to find out the score of each letter in each word
    q)wordzScore:wordz!@'[letScore;]each wordz 
    "aaron"| 0.06868045 0.1558029 0.08744038 0.06104928 0.08076312 
    "ababa"| 0.06868045 0.0063593 0.1224165 0.01240064 0.05373609 
    "aback"| 0.06868045 0.0063593 0.1224165 0.0645469 0.04038156 
    "abase"| 0.06868045 0.0063593 0.1224165 0.06486486 0.1799682 
    "abash"| 0.06868045 0.0063593 0.1224165 0.06486486 0.05532591

    3) And if we sum these and desc sort we get the following

    q)desc sum each wordzScore 
    "sauce"| 0.6 
    "saute"| 0.6 
    "salle"| 0.5974563 
    "caine"| 0.5971383 
    "slate"| 0.5879173

    So there we have it! Are sauce and saute the optimum starting words? If not they are certainly big contenders for “most popular baby names for twins in 2022!”  I will work on how we solve after line 1, but for now I must take a break before MB Games and Hasbro take action against me.

    Paulyc