Skip to content

Instantly share code, notes, and snippets.

@artificialsoph
Last active February 6, 2022 17:06
Show Gist options
  • Save artificialsoph/d7b540f04902f9ef7db6a9dcc3794a3e to your computer and use it in GitHub Desktop.
Save artificialsoph/d7b540f04902f9ef7db6a9dcc3794a3e to your computer and use it in GitHub Desktop.
Wordle Solver
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "view-in-github",
"colab_type": "text"
},
"source": [
"<a href=\"https://colab.research.google.com/gist/artificialsoph/9e1333f64efeaef4c44e8f62b32e5b06/wordle.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "bac6b4d7-dac2-4f70-a975-57c1e3e39644",
"metadata": {
"execution": {
"iopub.execute_input": "2022-01-08T18:24:10.897011Z",
"iopub.status.busy": "2022-01-08T18:24:10.896658Z",
"iopub.status.idle": "2022-01-08T18:24:11.405766Z",
"shell.execute_reply": "2022-01-08T18:24:11.405047Z",
"shell.execute_reply.started": "2022-01-08T18:24:10.896949Z"
},
"tags": [],
"id": "bac6b4d7-dac2-4f70-a975-57c1e3e39644"
},
"outputs": [],
"source": [
"import itertools\n",
"import string\n",
"import json\n",
"from pathlib import Path\n",
"\n",
"import numpy as np\n",
"import pandas as pd"
]
},
{
"cell_type": "code",
"source": [
"!wget https://bert.org/assets/posts/wordle/words.json\n",
"\n",
"solution_list = json.loads(Path(\"words.json\").read_text())[\"solutions\"]\n",
"\n",
"words = pd.DataFrame({\"word\": solution_list})"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "7HkZQUxs8QPd",
"outputId": "5cc62806-afd3-4842-a754-83b127fe3cc8"
},
"id": "7HkZQUxs8QPd",
"execution_count": null,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"--2022-02-06 16:55:36-- https://bert.org/assets/posts/wordle/words.json\n",
"Resolving bert.org (bert.org)... 192.99.33.40\n",
"Connecting to bert.org (bert.org)|192.99.33.40|:443... connected.\n",
"HTTP request sent, awaiting response... 200 OK\n",
"Length: 168680 (165K) [application/json]\n",
"Saving to: ‘words.json.3’\n",
"\n",
"words.json.3 100%[===================>] 164.73K 792KB/s in 0.2s \n",
"\n",
"2022-02-06 16:55:36 (792 KB/s) - ‘words.json.3’ saved [168680/168680]\n",
"\n"
]
}
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "6cd7f28d-613c-4a75-b911-c41afdf4ced0",
"metadata": {
"execution": {
"iopub.execute_input": "2022-01-08T18:24:11.406847Z",
"iopub.status.busy": "2022-01-08T18:24:11.406636Z",
"iopub.status.idle": "2022-01-08T18:24:11.781717Z",
"shell.execute_reply": "2022-01-08T18:24:11.781186Z",
"shell.execute_reply.started": "2022-01-08T18:24:11.406823Z"
},
"tags": [],
"id": "6cd7f28d-613c-4a75-b911-c41afdf4ced0"
},
"outputs": [],
"source": [
"# words = pd.read_csv(\n",
"# \"https://raw.githubusercontent.com/raun/Scrabble/master/words.txt\",\n",
"# names=[\"word\"],\n",
"# dtype=str,\n",
"# )"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "90168382-8589-431a-a27c-7a51fbf70895",
"metadata": {
"execution": {
"iopub.execute_input": "2022-01-08T18:24:11.784476Z",
"iopub.status.busy": "2022-01-08T18:24:11.784107Z",
"iopub.status.idle": "2022-01-08T18:24:11.814811Z",
"shell.execute_reply": "2022-01-08T18:24:11.814335Z",
"shell.execute_reply.started": "2022-01-08T18:24:11.784455Z"
},
"tags": [],
"id": "90168382-8589-431a-a27c-7a51fbf70895"
},
"outputs": [],
"source": [
"words.dropna(inplace=True)\n",
"words.word = words.word.str.lower()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "f20d519f-c612-4191-980a-a2eccd7f3ce5",
"metadata": {
"execution": {
"iopub.execute_input": "2022-01-08T18:24:11.815710Z",
"iopub.status.busy": "2022-01-08T18:24:11.815576Z",
"iopub.status.idle": "2022-01-08T18:24:11.838019Z",
"shell.execute_reply": "2022-01-08T18:24:11.837405Z",
"shell.execute_reply.started": "2022-01-08T18:24:11.815693Z"
},
"tags": [],
"id": "f20d519f-c612-4191-980a-a2eccd7f3ce5"
},
"outputs": [],
"source": [
"words = words.assign(length=words.word.apply(len))"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "95291102-9672-423d-aac5-330a62cd2f83",
"metadata": {
"execution": {
"iopub.execute_input": "2022-01-08T18:24:11.838994Z",
"iopub.status.busy": "2022-01-08T18:24:11.838801Z",
"iopub.status.idle": "2022-01-08T18:24:11.842848Z",
"shell.execute_reply": "2022-01-08T18:24:11.842164Z",
"shell.execute_reply.started": "2022-01-08T18:24:11.838972Z"
},
"tags": [],
"id": "95291102-9672-423d-aac5-330a62cd2f83"
},
"outputs": [],
"source": [
"def shannon(prob):\n",
"\n",
" if (prob == 0) or (prob == 1):\n",
" return 0\n",
" else:\n",
" return -prob * np.log2(prob) - (1 - prob) * np.log2(1 - prob)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "85362db4-da73-4fbc-87a7-64351b4eb2bc",
"metadata": {
"execution": {
"iopub.execute_input": "2022-01-08T18:24:11.844374Z",
"iopub.status.busy": "2022-01-08T18:24:11.843997Z",
"iopub.status.idle": "2022-01-08T18:24:11.857190Z",
"shell.execute_reply": "2022-01-08T18:24:11.856525Z",
"shell.execute_reply.started": "2022-01-08T18:24:11.844352Z"
},
"tags": [],
"id": "85362db4-da73-4fbc-87a7-64351b4eb2bc"
},
"outputs": [],
"source": [
"def find_scores(num_letters, include=\"\", exclude=\"\", place_pos={}, place_neg={}):\n",
" \"\"\"\n",
" num_letters (int): the number of letters in the target word\n",
" include (str): all the letters known to be included in the target word\n",
" exclude (str): all the letters known to be excluded from the target word\n",
" place_pos (dict): a dictionary representing all known letter placements\n",
" where keys are single character strings and values are a list of indices.\n",
" for example place_pos={\"a\": [0,3]} indicates that we know that a is in\n",
" the first position and the 4th (index 3)\n",
" place_neg (dict): a dictionary formatted as place_pos indicating the known\n",
" invalid letter placements. for example place_neg={\"l\": [0]} means that we\n",
" know that l does not go in the first position\n",
" \"\"\"\n",
"\n",
" show_cols = [\"word\", \"incl_info\", \"order_info\", \"score\"]\n",
"\n",
" # before anything else, only consider words of appropriate length\n",
" len_flag = words.length == num_letters\n",
"\n",
" curr_words = words.loc[len_flag].copy()\n",
"\n",
" # we want to calculate the remaining information content, and to do that we need to\n",
" # know which words are still consistent with what's known\n",
" incl_flag = curr_words.word.apply(lambda x: all(l in x for l in include))\n",
" excl_flag = curr_words.word.apply(lambda x: all(l not in x for l in exclude))\n",
"\n",
" pos_flag = curr_words.word.astype(bool)\n",
" if place_pos:\n",
" for l, i_list in place_pos.items():\n",
" for i in i_list:\n",
" pos_flag = pos_flag * curr_words.word.apply(lambda x: x[i] == l)\n",
"\n",
" neg_flag = curr_words.word.astype(bool)\n",
" if place_neg:\n",
" for l, i_list in place_neg.items():\n",
" for i in i_list:\n",
" neg_flag = neg_flag * curr_words.word.apply(lambda x: x[i] != l)\n",
"\n",
" possible_words = curr_words.loc[incl_flag & excl_flag & pos_flag & neg_flag].copy()\n",
"\n",
" # first step is to calculate information content for letter inclusion\n",
" letter_entr = {}\n",
"\n",
" unk_letters = set(string.ascii_lowercase) - (set(include) | set(exclude))\n",
"\n",
" for letter in unk_letters:\n",
" l_prob = sum(possible_words.word.str.contains(letter)) / len(possible_words)\n",
" letter_entr[letter] = shannon(l_prob)\n",
"\n",
" def find_entr_score(word):\n",
" score = 0\n",
" for l in set(word):\n",
" score += letter_entr.get(l, 0)\n",
" return score\n",
"\n",
" curr_words[\"incl_info\"] = curr_words[\"word\"].apply(find_entr_score)\n",
"\n",
" # second step is to calculate information content for letter order (i'm crudely treating these as independent)\n",
"\n",
" for i in range(num_letters):\n",
" possible_words[f\"letter_{i}\"] = possible_words.word.str[i]\n",
" # curr_words[f\"letter_{i}_prob\"] = 0\n",
"\n",
" curr_words.loc[:, f\"letter_{i}_info\"] = 0\n",
"\n",
" for l in possible_words[f\"letter_{i}\"].unique():\n",
"\n",
" l_prob = sum(possible_words[f\"letter_{i}\"] == l) / len(possible_words)\n",
"\n",
" l_entr = shannon(l_prob)\n",
"\n",
" curr_words.loc[curr_words.word.str[i] == l, f\"letter_{i}_info\"] = l_entr\n",
"\n",
" curr_words[\"order_info\"] = sum([curr_words[f\"letter_{i}_info\"] for i in range(5)])\n",
"\n",
" curr_words[\"score\"] = curr_words[\"order_info\"] + curr_words[\"incl_info\"]\n",
"\n",
" possible_words = curr_words.loc[incl_flag & excl_flag & pos_flag & neg_flag]\n",
"\n",
" print(f\"There are {len(possible_words)} valid guesses remaining.\")\n",
"\n",
" if len(possible_words) < 20:\n",
" print(possible_words.loc[:, show_cols].sort_values(\"score\", ascending=False))\n",
"\n",
" print(\"Best scoring words\")\n",
" print(curr_words.loc[:, show_cols].sort_values(\"score\", ascending=False).head(20))\n",
"\n",
"\n",
"# return possible_words"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "24d89627-b4a4-4a07-b32b-9367baea35bf",
"metadata": {
"execution": {
"iopub.execute_input": "2022-01-08T18:24:11.858264Z",
"iopub.status.busy": "2022-01-08T18:24:11.858041Z",
"iopub.status.idle": "2022-01-08T18:24:13.010032Z",
"shell.execute_reply": "2022-01-08T18:24:13.009202Z",
"shell.execute_reply.started": "2022-01-08T18:24:11.858246Z"
},
"tags": [],
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "24d89627-b4a4-4a07-b32b-9367baea35bf",
"outputId": "dd4611a7-e39d-4b56-9a2c-345be26fcf09"
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"There are 2315 valid guesses remaining.\n",
"Best scoring words\n",
" word incl_info order_info score\n",
"878 slate 4.519614 2.634631 7.154245\n",
"1607 saner 4.532960 2.537407 7.070367\n",
"915 stare 4.608247 2.441235 7.049482\n",
"560 arise 4.596709 2.428481 7.025190\n",
"1252 arose 4.611606 2.399833 7.011439\n",
"1668 raise 4.596709 2.409019 7.005728\n",
"45 crate 4.479965 2.516274 6.996239\n",
"721 snare 4.532960 2.461831 6.994792\n",
"1729 crane 4.404678 2.585947 6.990625\n",
"528 stale 4.519614 2.457568 6.977182\n",
"275 saute 4.380995 2.575988 6.956983\n",
"1004 share 4.385089 2.566871 6.951960\n",
"179 trace 4.479965 2.461325 6.941290\n",
"481 saint 4.315573 2.600365 6.915938\n",
"1543 shale 4.296456 2.583204 6.879660\n",
"162 store 4.511395 2.362554 6.873949\n",
"1627 slice 4.250362 2.606492 6.856854\n",
"1704 suite 4.269246 2.562212 6.831458\n",
"1750 slant 4.316162 2.515140 6.831302\n",
"872 irate 4.625930 2.205371 6.831301\n"
]
}
],
"source": [
"find_scores(5)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "e53ae6e0-8b25-4e54-a7b3-008a8a607c66",
"metadata": {
"execution": {
"iopub.execute_input": "2022-01-08T18:24:13.011787Z",
"iopub.status.busy": "2022-01-08T18:24:13.011390Z",
"iopub.status.idle": "2022-01-08T18:24:13.020832Z",
"shell.execute_reply": "2022-01-08T18:24:13.020223Z",
"shell.execute_reply.started": "2022-01-08T18:24:13.011765Z"
},
"id": "e53ae6e0-8b25-4e54-a7b3-008a8a607c66",
"outputId": "0404e3e5-6959-4b7c-97fb-ded51a5898b3"
},
"outputs": [
{
"data": {
"text/plain": [
"43.283232117401006"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"8938 / 2 ** 7.69"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "d29a574e-789a-4fe8-bb7b-0b05cb858dcd",
"metadata": {
"execution": {
"iopub.execute_input": "2022-01-08T18:24:13.021823Z",
"iopub.status.busy": "2022-01-08T18:24:13.021688Z",
"iopub.status.idle": "2022-01-08T18:24:13.589553Z",
"shell.execute_reply": "2022-01-08T18:24:13.589086Z",
"shell.execute_reply.started": "2022-01-08T18:24:13.021806Z"
},
"tags": [],
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "d29a574e-789a-4fe8-bb7b-0b05cb858dcd",
"outputId": "fca6b207-4ed0-4b2d-b236-a9c19a32c20b"
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"There are 17 valid guesses remaining.\n",
" word incl_info order_info score\n",
"1358 sulky 2.684629 3.005503 5.690132\n",
"875 silky 2.808151 2.855767 5.663918\n",
"655 spoil 2.543778 2.979483 5.523262\n",
"232 skill 1.871484 3.434342 5.305825\n",
"2250 sully 1.810648 3.460361 5.271009\n",
"1021 silly 1.934170 3.310626 5.244796\n",
"1743 surly 2.333208 2.909137 5.242345\n",
"254 spill 1.669797 3.434342 5.104139\n",
"247 swill 1.669797 3.284606 4.954404\n",
"1429 skull 1.747962 3.169775 4.917737\n",
"72 swirl 2.192357 2.629945 4.822302\n",
"1527 scold 1.919100 2.809663 4.728763\n",
"1884 scowl 2.068835 2.629945 4.698781\n",
"880 solid 2.394043 2.241857 4.635900\n",
"1644 spool 1.546276 2.779681 4.325957\n",
"1124 skulk 1.747962 2.495029 4.242991\n",
"1293 shyly 1.259424 2.559599 3.819023\n",
"Best scoring words\n",
" word incl_info order_info score\n",
"2019 spiky 3.480446 2.918648 6.399094\n",
"189 picky 4.003005 1.981786 5.984791\n",
"2287 willy 2.606465 3.310626 5.917090\n",
"2125 dully 2.333208 3.460361 5.793569\n",
"1067 dilly 2.456729 3.310626 5.767355\n",
"1321 curly 2.855767 2.909137 5.764904\n",
"754 juicy 3.330710 2.396089 5.726799\n",
"2000 bulky 2.684629 3.005503 5.690132\n",
"1358 sulky 2.684629 3.005503 5.690132\n",
"1626 icily 2.456729 3.223771 5.680500\n",
"875 silky 2.808151 2.855767 5.663918\n",
"2058 milky 2.808151 2.855767 5.663918\n",
"1003 murky 3.207189 2.454279 5.661467\n",
"1689 hilly 2.256927 3.310626 5.567553\n",
"103 spicy 3.129024 2.396089 5.525113\n",
"655 spoil 2.543778 2.979483 5.523262\n",
"1299 rocky 3.729748 1.781984 5.511732\n",
"2044 wooly 2.482943 3.023969 5.506912\n",
"1904 pinky 3.480446 1.981786 5.462232\n",
"898 dolly 2.333208 3.110823 5.444031\n"
]
}
],
"source": [
"find_scores(\n",
" 5,\n",
" include=\"sl\",\n",
" exclude=\"ate\",\n",
" place_pos={\"s\": [0]},\n",
" place_neg={\"l\": [1]},\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "7c3e8b8b-3d6e-4d1b-a46e-12a90180854b",
"metadata": {
"execution": {
"iopub.execute_input": "2022-01-08T18:24:13.590508Z",
"iopub.status.busy": "2022-01-08T18:24:13.590379Z",
"iopub.status.idle": "2022-01-08T18:24:13.594225Z",
"shell.execute_reply": "2022-01-08T18:24:13.593655Z",
"shell.execute_reply.started": "2022-01-08T18:24:13.590492Z"
},
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "7c3e8b8b-3d6e-4d1b-a46e-12a90180854b",
"outputId": "e53a8b9c-8927-4e39-cd14-8521af66044d"
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"0.32702273479474336"
]
},
"metadata": {},
"execution_count": 24
}
],
"source": [
"17 / 2 ** 5.7"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "a82bc065-760b-49d3-afeb-77598442101a",
"metadata": {
"execution": {
"iopub.execute_input": "2022-01-08T18:24:13.595436Z",
"iopub.status.busy": "2022-01-08T18:24:13.595200Z",
"iopub.status.idle": "2022-01-08T18:24:13.681419Z",
"shell.execute_reply": "2022-01-08T18:24:13.680912Z",
"shell.execute_reply.started": "2022-01-08T18:24:13.595411Z"
},
"tags": [],
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "a82bc065-760b-49d3-afeb-77598442101a",
"outputId": "fb333035-8e7c-4612-d326-fe9c93c2a56f"
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"There are 1 valid guesses remaining.\n",
" word incl_info order_info score\n",
"232 skill 0 0 0\n",
"Best scoring words\n",
" word incl_info order_info score\n",
"0 cigar 0 0 0\n",
"1591 fable 0 0 0\n",
"1539 wield 0 0 0\n",
"1540 femme 0 0 0\n",
"1541 lasso 0 0 0\n",
"1542 maize 0 0 0\n",
"1543 shale 0 0 0\n",
"1544 screw 0 0 0\n",
"1545 spree 0 0 0\n",
"1546 smoky 0 0 0\n",
"1547 whiff 0 0 0\n",
"1548 scent 0 0 0\n",
"1549 glade 0 0 0\n",
"1550 spent 0 0 0\n",
"1551 prism 0 0 0\n",
"1552 stoke 0 0 0\n",
"1553 riper 0 0 0\n",
"1538 heavy 0 0 0\n",
"1537 prude 0 0 0\n",
"1536 swept 0 0 0\n"
]
}
],
"source": [
"find_scores(\n",
" 5,\n",
" include=\"slk\",\n",
" exclude=\"ateuy\",\n",
" place_neg={\"l\": [1, 2], \"k\": [3]},\n",
" place_pos={\"s\": [0]},\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "fd5b69cb-3293-432c-918f-b52a0f154603",
"metadata": {
"execution": {
"iopub.execute_input": "2022-01-08T18:24:13.684605Z",
"iopub.status.busy": "2022-01-08T18:24:13.684422Z",
"iopub.status.idle": "2022-01-08T18:24:13.842743Z",
"shell.execute_reply": "2022-01-08T18:24:13.842191Z",
"shell.execute_reply.started": "2022-01-08T18:24:13.684587Z"
},
"id": "fd5b69cb-3293-432c-918f-b52a0f154603",
"outputId": "1178388d-e65a-4089-aac7-2e33772ce23e"
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"There are 1 valid guesses remaining.\n",
" word incl_info order_info score\n",
"20186 distal 0 0 0\n",
"Best scoring words\n",
" word incl_info order_info score\n",
"3 aahing 0 0 0\n",
"56363 ptotic 0 0 0\n",
"56387 pucker 0 0 0\n",
"56397 puddle 0 0 0\n",
"56404 puddly 0 0 0\n",
"56416 pueblo 0 0 0\n",
"56422 puffed 0 0 0\n",
"56423 puffer 0 0 0\n",
"56429 puffin 0 0 0\n",
"56438 pugged 0 0 0\n",
"56446 puggry 0 0 0\n",
"56453 pugree 0 0 0\n",
"56456 puisne 0 0 0\n",
"56461 pujahs 0 0 0\n",
"56466 puking 0 0 0\n",
"56473 pulers 0 0 0\n",
"56479 puling 0 0 0\n",
"56485 pulled 0 0 0\n",
"56486 puller 0 0 0\n",
"56488 pullet 0 0 0\n"
]
}
],
"source": [
"find_scores(\n",
" 6,\n",
" include=\"sailit\",\n",
" exclude=\"erpngmuc\",\n",
" place_pos={\"i\": [1], \"s\": [2], \"a\": [4]},\n",
" place_neg={\"s\": [0], \"a\": [1], \"i\": [2], \"l\": [2, 3], \"t\": [5]},\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "e7886dba-8094-4d36-b2b2-cab144a0df43",
"metadata": {
"execution": {
"iopub.execute_input": "2022-01-08T18:24:13.843618Z",
"iopub.status.busy": "2022-01-08T18:24:13.843488Z",
"iopub.status.idle": "2022-01-08T18:24:14.095679Z",
"shell.execute_reply": "2022-01-08T18:24:14.095010Z",
"shell.execute_reply.started": "2022-01-08T18:24:13.843601Z"
},
"tags": [],
"id": "e7886dba-8094-4d36-b2b2-cab144a0df43",
"outputId": "976704e2-1df8-4b05-d69b-81de0f3e99c0"
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"There are 6 valid guesses remaining.\n",
" word incl_info order_info score\n",
"78334 upheld 1.300045 3.786659 5.086704\n",
"18686 deluge 0.650022 4.404910 5.054932\n",
"18694 deluxe 0.650022 4.404910 5.054932\n",
"73048 teledu 0.650022 4.323206 4.973228\n",
"18680 delude 0.000000 4.673183 4.673183\n",
"21590 duffle 0.650022 3.786659 4.436681\n",
"Best scoring words\n",
" word incl_info order_info score\n",
"73052 telega 1.300045 4.054932 5.354977\n",
"78334 upheld 1.300045 3.786659 5.086704\n",
"18686 deluge 0.650022 4.404910 5.054932\n",
"18694 deluxe 0.650022 4.404910 5.054932\n",
"73048 teledu 0.650022 4.323206 4.973228\n",
"18391 defeat 1.300045 3.404910 4.704955\n",
"18396 defect 1.300045 3.404910 4.704955\n",
"18488 deftly 1.300045 3.404910 4.704955\n",
"59029 refelt 1.300045 3.404910 4.704955\n",
"18638 delfts 1.300045 3.404910 4.704955\n",
"18680 delude 0.000000 4.673183 4.673183\n",
"59147 refuge 1.300045 3.218341 4.518386\n",
"73288 tepefy 1.950067 2.486614 4.436681\n",
"73080 telfer 1.300045 3.136637 4.436681\n",
"76315 tupelo 1.300045 3.136637 4.436681\n",
"18462 defogs 1.300045 3.136637 4.436681\n",
"77358 unfelt 1.300045 3.136637 4.436681\n",
"21590 duffle 0.650022 3.786659 4.436681\n",
"52970 phlegm 1.950067 2.486614 4.436681\n",
"76507 tuxedo 1.300045 3.136637 4.436681\n"
]
}
],
"source": [
"find_scores(\n",
" 6,\n",
" include=\"ledu\",\n",
" exclude=\"sairbonc\",\n",
" place_neg={\"l\": [3], \"e\": [4], \"d\": [3], \"u\": [4]},\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "c58409eb-c8ad-47ab-9a61-23d2b3456b9e",
"metadata": {
"execution": {
"iopub.execute_input": "2022-01-08T18:24:14.096769Z",
"iopub.status.busy": "2022-01-08T18:24:14.096463Z",
"iopub.status.idle": "2022-01-08T18:24:14.264700Z",
"shell.execute_reply": "2022-01-08T18:24:14.264099Z",
"shell.execute_reply.started": "2022-01-08T18:24:14.096751Z"
},
"tags": [],
"id": "c58409eb-c8ad-47ab-9a61-23d2b3456b9e",
"outputId": "cbb32bf8-68a2-4714-9b31-c8dad3b76c60"
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"There are 3 valid guesses remaining.\n",
" word incl_info order_info score\n",
"18686 deluge 0.918296 0.918296 1.836592\n",
"18694 deluxe 0.918296 0.918296 1.836592\n",
"18680 delude 0.000000 0.918296 0.918296\n",
"Best scoring words\n",
" word incl_info order_info score\n",
"28780 galaxy 1.836592 0.918296 2.754888\n",
"13766 clingy 0.918296 0.918296 1.836592\n",
"30996 grange 0.918296 0.918296 1.836592\n",
"69409 staigs 0.918296 0.918296 1.836592\n",
"69496 stangs 0.918296 0.918296 1.836592\n",
"2065 ambage 0.918296 0.918296 1.836592\n",
"69931 stingo 0.918296 0.918296 1.836592\n",
"69934 stings 0.918296 0.918296 1.836592\n",
"69935 stingy 0.918296 0.918296 1.836592\n",
"70020 stodge 0.918296 0.918296 1.836592\n",
"70026 stodgy 0.918296 0.918296 1.836592\n",
"30993 grands 0.918296 0.918296 1.836592\n",
"70089 stooge 0.918296 0.918296 1.836592\n",
"24510 exogen 1.836592 0.000000 1.836592\n",
"8787 braggy 0.918296 0.918296 1.836592\n",
"6054 befogs 0.918296 0.918296 1.836592\n",
"8704 boxing 1.836592 0.000000 1.836592\n",
"1921 almugs 0.918296 0.918296 1.836592\n",
"6173 beings 0.918296 0.918296 1.836592\n",
"41022 linage 0.918296 0.918296 1.836592\n"
]
}
],
"source": [
"find_scores(\n",
" 6,\n",
" include=\"ledu\",\n",
" exclude=\"sairboncph\",\n",
" place_neg={\"l\": [3, 4], \"e\": [3, 4], \"d\": [3, 5], \"u\": [0, 4]},\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "6887dd18-c887-4f3d-9592-a5b8e21c7c6c",
"metadata": {
"execution": {
"iopub.execute_input": "2022-01-08T18:24:14.265585Z",
"iopub.status.busy": "2022-01-08T18:24:14.265455Z",
"iopub.status.idle": "2022-01-08T18:24:14.348512Z",
"shell.execute_reply": "2022-01-08T18:24:14.348003Z",
"shell.execute_reply.started": "2022-01-08T18:24:14.265568Z"
},
"id": "6887dd18-c887-4f3d-9592-a5b8e21c7c6c",
"outputId": "64ca9ade-acf0-4158-c979-eda43b7e53a7"
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"There are 1 valid guesses remaining.\n",
" word incl_info order_info score\n",
"50911 packs 0 0 0\n",
"Best scoring words\n",
" word incl_info order_info score\n",
"2 aahed 0 0 0\n",
"56372 pubes 0 0 0\n",
"56307 pseud 0 0 0\n",
"56311 pshaw 0 0 0\n",
"56321 psoae 0 0 0\n",
"56322 psoai 0 0 0\n",
"56323 psoas 0 0 0\n",
"56331 psych 0 0 0\n",
"56373 pubic 0 0 0\n",
"56433 puffy 0 0 0\n",
"56374 pubis 0 0 0\n",
"56384 puces 0 0 0\n",
"56386 pucka 0 0 0\n",
"56393 pucks 0 0 0\n",
"56412 pudgy 0 0 0\n",
"56414 pudic 0 0 0\n",
"56290 psalm 0 0 0\n",
"56285 pryer 0 0 0\n",
"56280 pruta 0 0 0\n",
"56263 prune 0 0 0\n"
]
}
],
"source": [
"find_scores(\n",
" 5,\n",
" include=\"asckp\",\n",
" exclude=\"trelinhumy\",\n",
" place_pos={\"a\": [1], \"s\": [4]},\n",
" place_neg={\"c\": [0], \"k\": [4]},\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "6d6ce712-55e7-4484-a508-e5d46d9cd4a2",
"metadata": {
"execution": {
"iopub.execute_input": "2022-01-08T18:24:14.349330Z",
"iopub.status.busy": "2022-01-08T18:24:14.349199Z",
"iopub.status.idle": "2022-01-08T18:24:14.503944Z",
"shell.execute_reply": "2022-01-08T18:24:14.503414Z",
"shell.execute_reply.started": "2022-01-08T18:24:14.349314Z"
},
"tags": [],
"id": "6d6ce712-55e7-4484-a508-e5d46d9cd4a2",
"outputId": "38d222cf-7df1-4629-9c3d-698e50ff7a7d"
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"There are 8 valid guesses remaining.\n",
" word incl_info order_info score\n",
"7825 blush 1.622556 4.166121 5.788677\n",
"27028 flush 1.622556 4.166121 5.788677\n",
"54324 plush 1.622556 4.166121 5.788677\n",
"67076 slush 0.811278 4.576990 5.388268\n",
"65419 shlub 1.622556 3.396405 5.018962\n",
"67055 slump 1.354843 3.664119 5.018962\n",
"63516 schul 1.354843 3.396405 4.751248\n",
"67020 sluff 0.811278 3.664119 4.475397\n",
"Best scoring words\n",
" word incl_info order_info score\n",
"27028 flush 1.622556 4.166121 5.788677\n",
"7825 blush 1.622556 4.166121 5.788677\n",
"54324 plush 1.622556 4.166121 5.788677\n",
"26997 flump 2.166121 3.253250 5.419370\n",
"54257 plumb 2.166121 3.253250 5.419370\n",
"67076 slush 0.811278 4.576990 5.388268\n",
"13163 chump 2.709685 2.441971 5.151657\n",
"65728 shush 0.811278 4.309277 5.120555\n",
"67294 smush 1.354843 3.765712 5.120555\n",
"65419 shlub 1.622556 3.396405 5.018962\n",
"67055 slump 1.354843 3.664119 5.018962\n",
"9425 brush 1.622556 3.354843 4.977399\n",
"26686 flesh 1.622556 3.354843 4.977399\n",
"26520 flash 1.622556 3.354843 4.977399\n",
"53932 plash 1.622556 3.354843 4.977399\n",
"7777 bluff 1.622556 3.253250 4.875806\n",
"63842 scuff 1.354843 3.396405 4.751248\n",
"63516 schul 1.354843 3.396405 4.751248\n",
"54287 plump 1.354843 3.253250 4.608092\n",
"81649 whump 2.166121 2.441971 4.608092\n"
]
}
],
"source": [
"find_scores(\n",
" 5,\n",
" include=\"sl\",\n",
" exclude=\"tarenoiy\",\n",
" place_neg={\"s\": [4], \"l\": [3]},\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "50d9256c-cd22-4f71-a156-053497c30a5e",
"metadata": {
"execution": {
"iopub.execute_input": "2022-01-08T18:24:14.505070Z",
"iopub.status.busy": "2022-01-08T18:24:14.504861Z",
"iopub.status.idle": "2022-01-08T18:24:14.598934Z",
"shell.execute_reply": "2022-01-08T18:24:14.598376Z",
"shell.execute_reply.started": "2022-01-08T18:24:14.505052Z"
},
"tags": [],
"id": "50d9256c-cd22-4f71-a156-053497c30a5e",
"outputId": "16f23e8b-0945-49ef-e8b1-c791f8ce8eee"
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"There are 2 valid guesses remaining.\n",
" word incl_info order_info score\n",
"67055 slump 2.0 2 4.0\n",
"67020 sluff 1.0 2 3.0\n",
"Best scoring words\n",
" word incl_info order_info score\n",
"26997 flump 3.0 2 5.0\n",
"28213 frump 3.0 2 5.0\n",
"67055 slump 2.0 2 4.0\n",
"16673 crump 2.0 2 4.0\n",
"75305 tramp 2.0 2 4.0\n",
"81599 whomp 2.0 2 4.0\n",
"13838 clomp 2.0 2 4.0\n",
"81649 whump 2.0 2 4.0\n",
"71508 swamp 2.0 2 4.0\n",
"31571 grump 2.0 2 4.0\n",
"55818 primp 2.0 2 4.0\n",
"16392 crimp 2.0 2 4.0\n",
"55127 pouff 2.0 2 4.0\n",
"63282 scamp 2.0 2 4.0\n",
"16075 cramp 2.0 2 4.0\n",
"12243 champ 2.0 2 4.0\n",
"12794 chimp 2.0 2 4.0\n",
"68720 spiff 2.0 2 4.0\n",
"73945 thump 2.0 2 4.0\n",
"12969 chomp 2.0 2 4.0\n"
]
}
],
"source": [
"find_scores(\n",
" 5,\n",
" include=\"slu\",\n",
" exclude=\"tarenoiybh\",\n",
" place_neg={\"s\": [3, 4], \"l\": [3]},\n",
" place_pos={\"l\": [1], \"u\": [2]},\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "720ea9f0-9941-4458-818d-95fec95ed86e",
"metadata": {
"id": "720ea9f0-9941-4458-818d-95fec95ed86e"
},
"outputs": [],
"source": [
""
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python [conda env:ds]",
"language": "python",
"name": "conda-env-ds-py"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.1"
},
"colab": {
"name": "wordle.ipynb",
"provenance": [],
"collapsed_sections": [],
"include_colab_link": true
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment