{"id":819,"date":"2022-02-17T16:59:27","date_gmt":"2022-02-18T00:59:27","guid":{"rendered":"http:\/\/5.189.132.178\/?p=819"},"modified":"2022-02-17T16:59:31","modified_gmt":"2022-02-18T00:59:31","slug":"wordle-%e6%8f%90%e7%a4%ba%e5%99%a8","status":"publish","type":"post","link":"https:\/\/cronopio.space\/?p=819","title":{"rendered":"Wordle \u63d0\u793a\u5668"},"content":{"rendered":"\n<p>\u5fc3\u8840\u6765\u6f6e\u5199\u7684Wordle\u63d0\u793a\u5668\uff0c\u601d\u8def\u5927\u6982\u5982\u4e0b<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\u628a\u8c1c\u9898\u4e2d\u5df2\u7ecf\u66b4\u9732\u7684\u4fe1\u606f\u8f6c\u6362\u4e3a\u6b63\u5219\u8868\u8fbe\u5f0f<ul><li>\u7eff\u8272=\u56fa\u5b9a\u5b57\u6bcd\uff0c\u9ec4\u8272=\u542b\u6709\u5b57\u6bcd&amp;\u4f4d\u7f6e\u9519\u8bef\uff0c\u9ed1\u8272=\u4e0d\u542b\u5b57\u6bcd<\/li><\/ul><\/li><li>\u4ece\u8bcd\u8868(*)\u91cc\u7b5b\u9009\u51fa\u7b26\u5408\u89c4\u8303\u7684\u8bcd\uff0c\u5373\u6240\u6709\u7684\u201c\u53ef\u80fd\u7b54\u6848\u201d<\/li><li>\u8ba1\u7b97\u6240\u6709\u53ef\u80fd\u7b54\u6848\u7684mutual information\uff0c\u627e\u5230\u4e4b\u4e2dmutual information\u6700\u5927\u7684\uff08\u51e0\u4e2a\uff09\u8bcd(**)<ul><li>\u8fd9\u91cc\u4f7f\u7528\u4e86\u7b80\u5355\u7684\u8ba1\u6570\u6cd5\uff1a\u7eff\u8272=2\u5206\uff0c\u9ec4\u8272=1\u5206\uff0c\u9ed1\u8272=0\u5206<\/li><\/ul><\/li><\/ul>\n\n\n\n<p>\u6ce8\uff1a<\/p>\n\n\n\n<p>\u8bcd\u8868\uff1a\u6211\u7528\u4e86github\u4e0a\u7684\u8fd9\u4e2a\u8bcd\u8868<a href=\"https:\/\/github.com\/derekchuank\/high-frequency-vocabulary\/blob\/master\/30k.txt\">derekchuank\/high-frequency-vocabulary<\/a>\u3002\u7ecf\u561f\u53cb<a href=\"https:\/\/moresci.sale\/@pod\">@pod@moresci.sale<\/a> \u63d0\u9192\uff0c\u5176\u5b9ewordle\u6709dump\u51fa\u7684\u8bcd\u8868\uff0c\u8bcd\u5e93\u5927\u7ea62.3k\uff0c\u5141\u8bb8\u8f93\u5165\u5927\u7ea610.6k\uff0c\u6765\u6e90\u81ea\u8fd9\u4e2areddit\u8ba8\u8bba\u4e32 <a rel=\"noreferrer noopener\" href=\"https:\/\/www.reddit.com\/r\/wordle\/comments\/s4tcw8\/a_note_on_wordles_word_list\/hstkip2\/\" target=\"_blank\">a_note_on_wordles_word_list\/<\/a>\u3002\u53ef\u4ee5\u81ea\u884c\u66ff\u6362\u3002<\/p>\n\n\n\n<p>\u7b54\u6848\u8868\uff1areddit\u7684\u8ba8\u8bba\u6307\u51fa\u6bcf\u671f\u95ee\u9898\u7684\u7b54\u6848\u662f\u4eba\u5de5\u6311\u9009\u7684\u800c\u975e\u968f\u673a\u62bd\u53d6\uff0c\u8fd9\u610f\u5473\u7740\u4fe1\u606f\u5206\u5e03\u4e0e\u9ed8\u8ba4\u7684\u5e73\u5747\u5206\u5e03\u4e0d\u7b26\u3002Well\uff0c\u65e2\u7136\u7b54\u6848\u8868\u67092.3k\u8bcd\uff0c\u5c31\u7b97\u662f\u4eba\u5de5\u6311\u9009\u4e5f\u8db3\u591f\u591a\u8bcd\u4e86\u3002<\/p>\n\n\n\n<p>\u6709\u8da3\u7684\u53d1\u73b0\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\u4ece\u8bcd\u8868\u4e0a\u6765\u770b\uff0c\u6700\u597d\u7684\u201c\u8d77\u59cb\u8bcd\u201d\u5e76\u4e0d\u662fadieu\u800c\u662frates, aries, cares, lanes\u8fd9\u51e0\u4e2a\uff0c\u56e0\u4e3au\u8fd9\u4e2a\u539f\u56e0\u51fa\u73b0\u6b21\u6570\u5176\u5b9e\u4e0d\u5982\u8f85\u97f3r\u548cs\u9ad8<\/li><li>\u5c31\u7b97\u7528\u8bcd\u8868\u4f5c\u5f0a\uff0c\u4e5f\u633a\u9700\u8981\u8fd0\u6c14\u7684\uff0c\u6bd4\u5982Wordle 243\uff0c\u6700\u540e\u9700\u8981\u4ece4\u4e2a\u5408\u6cd5\u8bcd\u91cc\u968f\u673a\u5c1d\u8bd5\uff0c\u6211\u7684\u8fd9\u4e2a\u7b56\u7565\u7684\u6b65\u6570\u671f\u671b\u503c\u662f4.<\/li><\/ul>\n\n\n\n<p>\u4ee3\u7801\u5927\u6982\u8fd9\u6837<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"python\" class=\"language-python\">import numpy as np\nimport re\n\n# # create 5-letter word list\n# with open(\"30k.txt\") as file:\n#     for line in file:\n#     \tw = line.rstrip()\n#     \tif len(w)==5:\n#     \t\twith open('5letterwords.txt', 'a') as fnew:\n#     \t\t\tfnew.write(w+'\\n')\n\n\ndef info_score(target,current,matchscore=2,containscore=1):\n\t\"\"\"\n    compute information score\n    target: target word\n    current: current try\n    change the scores to optimize the searching process\n    \"\"\"\n\ts = 0\n\tfor i in range(5):\n\t\tif current[i]==target[i]:\n\t\t\ts+=matchscore\n\t\telif current[i] in target:\n\t\t\ts+=containscore\n\treturn s\n\n\n\ndef main():\n\t# run hinter\n\n\t# get word list\n\twith open(\"5letterwords.txt\") as f: \n\t\twords=[line.strip() for line in f]\n\n\t# initialize masks\n\tletters_contain = []\n\tpattern = [\"[^0]\"]*5\n\tdone = [False]*5\n\n\twhile not all(done):\n\n\t\t# new inpt from user\n\t\tw = input(\"Please enter your first try word: \")\n\t\tm = input(\"Please enter your result (black=0,yellow=1,green=2): \")\n\n\t\t# loop through new input\n\t\tfor i in range(5):\n\t\t\tif m[i]=='2':\n\t\t\t\t# correct, remove regax mask and mark as done\n\t\t\t\tpattern[i]=w[i]\n\t\t\t\tdone[i]=True\n\t\t\telif m[i]=='1':\n\t\t\t\t# semi-correct, add to contain list and mask this index\n\t\t\t\tletters_contain+=w[i]\n\t\t\t\tpattern[i]=pattern[i][:-1]+w[i]+']'\n\t\t\telif m[i]=='0':\n\t\t\t\t# wrong guess, add to all regax mask\n\t\t\t\tfor j in range(5):\n\t\t\t\t\tif not done[j]:\n\t\t\t\t\t\tpattern[j]=pattern[j][:-1]+w[i]+']'\n\t\t# exit if done\n\t\tif all(done): \n\t\t\tprint(\"You solved it. Bye.\")\n\t\t\texit()\n\t\t# apply regax and contain list\n\t\twords_new = [wd for wd in words if \n\t\t\t\tre.match('^'+(\"\").join(pattern)+'$',wd) \n\t\t\t\tis not None and all([l in wd for l in letters_contain])]\n\t\t# exit if funny problem happened\n\t\tif not words_new:\n\t\t\tprint(\"out of words, maybe something wrong?\")\n\t\t\texit()\n\t\t# compute similarity matrix\n\t\tsim_matrix =[[info_score(x,y) for y in words_new] for x in words_new]\n\t\t# zip and sort and print results\n\t\tmutural_info_sums = list(zip(words_new, [sum(x) for x in sim_matrix]))\n\t\tbest_guess = [x[0] for x in sorted(mutural_info_sums, key=lambda x: x[1],\n\t\t\treverse=True)[:5]]\n\t\tprint(\"Best next guesses are \"+(\", \").join(best_guess)+\".\")\n\n\nif __name__ == \"__main__\":\n    main()\n<\/code><\/pre>\n\n\n\n<p>\u6548\u679c\u5927\u6982\u662f\u8fd9\u6837<\/p>\n\n\n\n<p>\u7b54\u6848\u662frobin<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/5.189.132.178\/wp-content\/uploads\/2022\/02\/image-6.png\" alt=\"\" class=\"wp-image-829\" width=\"422\" height=\"119\" srcset=\"https:\/\/cronopio.space\/wp-content\/uploads\/2022\/02\/image-6.png 422w, https:\/\/cronopio.space\/wp-content\/uploads\/2022\/02\/image-6-300x85.png 300w\" sizes=\"auto, (max-width: 422px) 100vw, 422px\" \/><\/figure>\n\n\n\n<p>\u7b54\u6848\u662fslime:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"428\" height=\"270\" src=\"http:\/\/5.189.132.178\/wp-content\/uploads\/2022\/02\/image-7.png\" alt=\"\" class=\"wp-image-830\" srcset=\"https:\/\/cronopio.space\/wp-content\/uploads\/2022\/02\/image-7.png 428w, https:\/\/cronopio.space\/wp-content\/uploads\/2022\/02\/image-7-300x189.png 300w\" sizes=\"auto, (max-width: 428px) 100vw, 428px\" \/><\/figure>\n\n\n\n<p>\u7b54\u6848\u662fabbey:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"422\" height=\"175\" src=\"http:\/\/5.189.132.178\/wp-content\/uploads\/2022\/02\/image-9.png\" alt=\"\" class=\"wp-image-832\" srcset=\"https:\/\/cronopio.space\/wp-content\/uploads\/2022\/02\/image-9.png 422w, https:\/\/cronopio.space\/wp-content\/uploads\/2022\/02\/image-9-300x124.png 300w\" sizes=\"auto, (max-width: 422px) 100vw, 422px\" \/><\/figure>\n\n\n\n<p>\u7b54\u6848\u662faloft: \u5f88\u5947\u602a\u8fd9\u4e2a\u8bcd\u4e0d\u572830k list\u91cc<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"420\" height=\"170\" src=\"http:\/\/5.189.132.178\/wp-content\/uploads\/2022\/02\/image-8.png\" alt=\"\" class=\"wp-image-831\" srcset=\"https:\/\/cronopio.space\/wp-content\/uploads\/2022\/02\/image-8.png 420w, https:\/\/cronopio.space\/wp-content\/uploads\/2022\/02\/image-8-300x121.png 300w\" sizes=\"auto, (max-width: 420px) 100vw, 420px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>\u5fc3\u8840\u6765\u6f6e\u5199\u7684Wordle\u63d0\u793a\u5668\uff0c\u601d\u8def\u5927\u6982\u5982\u4e0b \u628a\u8c1c\u9898\u4e2d\u5df2\u7ecf\u66b4\u9732\u7684\u4fe1\u606f\u8f6c\u6362\u4e3a\u6b63\u5219\u8868\u8fbe\u5f0f \u7eff\u8272=\u56fa\u5b9a\u5b57\u6bcd\uff0c\u9ec4\u8272=\u542b &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/cronopio.space\/?p=819\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">\u201cWordle \u63d0\u793a\u5668\u201d<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[216],"tags":[],"class_list":["post-819","post","type-post","status-publish","format-standard","hentry","category-216"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/cronopio.space\/index.php?rest_route=\/wp\/v2\/posts\/819","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cronopio.space\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cronopio.space\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cronopio.space\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cronopio.space\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=819"}],"version-history":[{"count":0,"href":"https:\/\/cronopio.space\/index.php?rest_route=\/wp\/v2\/posts\/819\/revisions"}],"wp:attachment":[{"href":"https:\/\/cronopio.space\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=819"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cronopio.space\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=819"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cronopio.space\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=819"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}