feat(web): add info page

This commit is contained in:
2026-08-23 14:00:35 +02:00
parent 6e6e1b67ec
commit 46e977acf5
6 changed files with 202 additions and 2 deletions
+1 -1
View File
@@ -14,7 +14,7 @@ stdenv.mkDerivation (finalAttrs: {
yarnOfflineCache = fetchYarnDeps {
yarnLock = finalAttrs.src + "/yarn.lock";
hash = "sha256-okhACATsv6jqUrbvoRN+PTTc3FbqDT7iocnL6lr7R70=";
hash = "sha256-MTyHX2+/U7jRB1SJWbK9Td43zq+nclQwx7oDZbX0DqA=";
};
yarnBuildScript = "build-no-wasm";
+2
View File
@@ -16,6 +16,7 @@
},
"devDependencies": {
"@sveltejs/vite-plugin-svelte": "^7.3.0",
"@tailwindcss/typography": "^0.5.20",
"@tailwindcss/vite": "^4.3.3",
"npm-run-all": "^4.1.5",
"tailwindcss": "^4.3.3",
@@ -26,6 +27,7 @@
"vite-plugin-wasm-pack-watcher": "^1.0.1"
},
"dependencies": {
"@humanspeak/svelte-markdown": "^1.8.7",
"@lucide/svelte": "^1.33.0",
"esbuild": "^0.28.2",
"katex": "^0.18.4",
+58 -1
View File
@@ -13,9 +13,11 @@
EvaluateWordsResult,
EvaluateWordsProgress,
} from "./solver/types.ts";
import info_md from "./assets/info.md?raw";
import SolverOutput from "./components/SolverOutput.svelte";
import { FolderGit2 } from "@lucide/svelte";
import { CircleX, FolderGit2, Info } from "@lucide/svelte";
import { tick, onMount } from "svelte";
import SvelteMarkdown from "@humanspeak/svelte-markdown";
let guesses = $state([
{
@@ -30,6 +32,8 @@
},
]);
let show_info = $state(false);
let infos_gained: (Promise<GuessResult> | null)[] = $state([null]);
let use_default_wordle_answers: boolean = $state(true);
@@ -166,6 +170,15 @@
>
<FolderGit2 />
</a>
<a
class="fixed top-4 left-4"
onclick={() => {
show_info = true;
}}
>
<Info />
</a>
<div class="text-center">
<h1 class="mb-4 text-3xl font-bold">Wordle Solver</h1>
@@ -244,6 +257,50 @@
/>
{/if}
</div>
{#if show_info}
<div
class="fixed inset-0 z-50 flex items-center justify-center bg-black/60"
tabindex="-1"
role="button"
onclick={() => (show_info = false)}
onkeydown={() => (show_info = false)}
>
<div
class="relative flex flex-col
rounded-lg
bg-zinc-900
p-6 shadow-xl
md:max-w-[75vw]
md:max-h-[75vh]
max-w-[calc(100vw-3rem)]
max-h-[calc(100vh-3rem)]
overflow-hidden"
tabindex="0"
role="dialog"
onclick={(e) => e.stopPropagation()}
onkeydown={(e) => e.stopPropagation()}
>
<div
class="absolute top-4 right-4"
tabindex="-1"
role="button"
onclick={() => (show_info = false)}
onkeydown={() => (show_info = false)}
>
<CircleX />
</div>
<div
class="prose prose-invert max-w-none
h-full
overflow-y-auto
overflow-x-hidden"
>
<SvelteMarkdown source={info_md} />
</div>
</div>
</div>
{/if}
</div>
<style>
+1
View File
@@ -1,4 +1,5 @@
@import "tailwindcss";
@plugin "@tailwindcss/typography";
html,
body {
+45
View File
@@ -0,0 +1,45 @@
# Wordle Solver
This wordle solver uses an information theory based approach to
evaluate the next-best-guess. It's heavily inspired by [3b1b's approach](https://www.youtube.com/watch?v=v68zYyaEmEA)
on solving wordle.
## How to use?
You can run the solver at any time to tell you five best next guesses (ranked).
However when the solver has no information this can take quite some time. So it's
best to make your first guess (e.g. "CRANE", "SALES", ...):
1. Once your wordle game gave you an answer, type it into the interface:
- type letters to input them
- click a cell to change it's color (or cycle it with <Space>)
2. To give the solver the information of your guess press enter (or the little enter icon next to the line)
3. The solver will tell you the amount of information gained by this guess.
4. Run the solver to get a new next-best-guess and repeat until you found the answer
## Solution Space
The solution space is by default the list of possible wordle-answers (uncheck the box to use all valid words as possible answers).
Above your inputs you can see how many possible answers are still left given your guesses with a value of
remaining uncertainty in bits (how many yes-no questions are required to identify an item in the equally distributed set).
The goal is to reach 0bits of uncertainty, meaning one word left.
Sometimes when adding a guess there may appear an error symbol. This occurrs when the guess would empty
the solution space. This can only happen if the solution space did not contain the solution of your wordle game (or there some inconsistencies in the guesses).
In this case you might wanna allow all valid words as possible answers.
## The Solver's output
- p(x) is the probability, that the word is actually the solution.
Often it will be 0, because the word is not a possible solution anymore.
If so, the expected information of guessing this that high, that it is worth guessing it.
- E\[Inf.\] The expected information to gain when guessing this word. (I.e. by how much do we expect to shrink the solution space?)
- E\[Score.\] The expected number of guesses required to solve the wordle when you guess this word now. It's based on a heuristic combination
of the current score, p(x) and E\[Inf.\].
+95
View File
@@ -154,6 +154,21 @@
resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.28.2.tgz#b21affb804cc167c133d95f45b3a1dc1323b9a87"
integrity sha512-5ebpxr3nWMzrL/rnUI755Jkuee0bHL/Gq0WTF9lvcpv73wAp5eu8MfBUgWK9bhWvZjj7yX8etf/8tI8Ney695g==
"@humanspeak/memory-cache@^1.1.2":
version "1.1.2"
resolved "https://registry.yarnpkg.com/@humanspeak/memory-cache/-/memory-cache-1.1.2.tgz#2bd14a51782b30232fb544dab54fc20efb0171a8"
integrity sha512-6kmeqrCVThw4RYZsJ74l9cOdZQ84XHnGIzrv+Po49CZBNNVDEzi0CGsTx+KKmr/Hb6hY6yDGxeWTiz4VHkdsEg==
"@humanspeak/svelte-markdown@^1.8.7":
version "1.8.7"
resolved "https://registry.yarnpkg.com/@humanspeak/svelte-markdown/-/svelte-markdown-1.8.7.tgz#30f21678adf8434ac35f22c8cdd4ddf0666ee08c"
integrity sha512-IJFFF7QuKytGBIDy/fp8xeAxMjuFfV1rt3H8t6kjDlIckVTwCTD6WPFIbirlgeingOdD6j4U6Ox8aHu0YTe2Xw==
dependencies:
"@humanspeak/memory-cache" "^1.1.2"
github-slugger "^2.0.0"
htmlparser2 "^12.0.0"
marked "^18.0.9"
"@jridgewell/gen-mapping@^0.3.5":
version "0.3.13"
resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz#6342a19f44347518c93e43b1ac69deb3c4656a1f"
@@ -626,6 +641,13 @@
"@tailwindcss/oxide-win32-arm64-msvc" "4.3.3"
"@tailwindcss/oxide-win32-x64-msvc" "4.3.3"
"@tailwindcss/typography@^0.5.20":
version "0.5.20"
resolved "https://registry.yarnpkg.com/@tailwindcss/typography/-/typography-0.5.20.tgz#9feb7fb1d5f2f7b5360c22e24651210db74c34df"
integrity sha512-hwbzQuNUfcPvbegQFatVPl/MY/tcM9KLl963hQ5laJKPh81TEZ1+dNG9PirGvcaDBkp+BCshExAyKVPW91dozw==
dependencies:
postcss-selector-parser "6.0.10"
"@tailwindcss/vite@^4.3.3":
version "4.3.3"
resolved "https://registry.yarnpkg.com/@tailwindcss/vite/-/vite-4.3.3.tgz#1f4037badcb5e6c6bb574d3d8a0172c83f26b97f"
@@ -793,6 +815,11 @@ cross-spawn@^6.0.5:
shebang-command "^1.2.0"
which "^1.2.9"
cssesc@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/cssesc/-/cssesc-3.0.0.tgz#37741919903b868565e1c09ea747445cd18983ee"
integrity sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==
data-view-buffer@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/data-view-buffer/-/data-view-buffer-1.0.2.tgz#211a03ba95ecaf7798a8c7198d79536211f88570"
@@ -853,6 +880,36 @@ devalue@^5.8.1:
resolved "https://registry.yarnpkg.com/devalue/-/devalue-5.9.0.tgz#5d30db41a0db9171cf4ee9dbf6617e0b77cd7c2a"
integrity sha512-RWrqdArjvPbsATEhOPUo6Wndc/iWnkWKlhIrdlF3zMMYo/c3CVtoaVAyLtWxz5h8nSlkHzxnzV2uLydPXmtF+A==
dom-serializer@^3.0.0:
version "3.1.1"
resolved "https://registry.yarnpkg.com/dom-serializer/-/dom-serializer-3.1.1.tgz#54be70ee4fcc2da010f488165e62294798dc57d3"
integrity sha512-4MEa38/QexBob6gFNwu+EGdWvhJ1OKuNwdYY3Y3NyeWDQfnGeDYQUDfIRzWu5B5gsv03so2Uxd28YC6zrsx3Lw==
dependencies:
domelementtype "^3.0.0"
domhandler "^6.0.0"
entities "^8.0.0"
domelementtype@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/domelementtype/-/domelementtype-3.0.0.tgz#e6c0a24bd39ca5eb7ea67a98d2f699497d7bcc55"
integrity sha512-umCQid3jKbDmVjx8jGaW7uUykm4DEUeyV21hPxNMo2nV955DhUThwqyOIDtreepP31hl84X7G5U9ZfsWvIB3Pg==
domhandler@^6.0.0:
version "6.0.1"
resolved "https://registry.yarnpkg.com/domhandler/-/domhandler-6.0.1.tgz#75f351a03a6e10c35e08418f9cf0d287e00797cf"
integrity sha512-gYzvtM72ZtxQO0T048kd6HWSbbGCNOUwcnfQ01cqIJ4X2IYKFFHZ5mKvrQETcFXxsRObZulDaKmy//R7TPtsBg==
dependencies:
domelementtype "^3.0.0"
domutils@^4.0.2:
version "4.0.2"
resolved "https://registry.yarnpkg.com/domutils/-/domutils-4.0.2.tgz#0c1ac1fdbe8f554a60a6f5eb143ee85630327c94"
integrity sha512-qI4JLRKnSzqFqr7hAlS5xQDusBCjKSEG4t4+7aNrIQMHBcsC2TGEhuyABJdYkgSewL57PNLYEiibY2iPKhKpaA==
dependencies:
dom-serializer "^3.0.0"
domelementtype "^3.0.0"
domhandler "^6.0.0"
dunder-proto@^1.0.0, dunder-proto@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/dunder-proto/-/dunder-proto-1.0.1.tgz#d7ae667e1dc83482f8b70fd0f6eefc50da30f58a"
@@ -870,6 +927,11 @@ enhanced-resolve@^5.24.1:
graceful-fs "^4.2.4"
tapable "^2.3.3"
entities@^8.0.0:
version "8.0.0"
resolved "https://registry.yarnpkg.com/entities/-/entities-8.0.0.tgz#c1df5fe3602429747fa233d0dd26f142f0ce4743"
integrity sha512-zwfzJecQ/Uej6tusMqwAqU/6KL2XaB2VZ2Jg54Je6ahNBGNH6Ek6g3jjNCF0fG9EWQKGZNddNjU5F1ZQn/sBnA==
error-ex@^1.3.1:
version "1.3.4"
resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.4.tgz#b3a8d8bb6f92eecc1629e3e27d3c8607a8a32414"
@@ -1115,6 +1177,11 @@ get-symbol-description@^1.1.0:
es-errors "^1.3.0"
get-intrinsic "^1.2.6"
github-slugger@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/github-slugger/-/github-slugger-2.0.0.tgz#52cf2f9279a21eb6c59dd385b410f0c0adda8f1a"
integrity sha512-IaOQ9puYtjrkq7Y0Ygl9KDZnrf/aiUJYUpVf89y8kyaxbRG7Y1SrX/jaumrv81vc61+kiMempujsM3Yw7w5qcw==
globalthis@^1.0.4:
version "1.0.4"
resolved "https://registry.yarnpkg.com/globalthis/-/globalthis-1.0.4.tgz#7430ed3a975d97bfb59bcce41f5cabbafa651236"
@@ -1181,6 +1248,16 @@ hosted-git-info@^2.1.4:
resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.8.9.tgz#dffc0bf9a21c02209090f2aa69429e1414daf3f9"
integrity sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==
htmlparser2@^12.0.0:
version "12.0.0"
resolved "https://registry.yarnpkg.com/htmlparser2/-/htmlparser2-12.0.0.tgz#6a679d0f57c525990f9cbad8a585b320ecc6d198"
integrity sha512-Tz7u1i95/g2x2jz81+x0FBVhBhY5aRTvD3tXXdFaljuNdzDLJ8UGNRrTcj2cgQvAg3iW/h77Fz15nLW0L0CrZw==
dependencies:
domelementtype "^3.0.0"
domhandler "^6.0.0"
domutils "^4.0.2"
entities "^8.0.0"
internal-slot@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/internal-slot/-/internal-slot-1.1.0.tgz#1eac91762947d2f7056bc838d93e13b2e9604961"
@@ -1579,6 +1656,11 @@ magic-string@^1.0.0:
dependencies:
"@jridgewell/sourcemap-codec" "^1.5.5"
marked@^18.0.9:
version "18.0.10"
resolved "https://registry.yarnpkg.com/marked/-/marked-18.0.10.tgz#a09ac1f54e378b9efc8b31707adc188fdc047d2e"
integrity sha512-FJeH4bRpYoXiggcgriCGItKCSv3xkngJc4QCZ/rkQCogU3VYaLxYJoZl8Nw/b4+x7iij/pd+09mZ6A1dXzpL0A==
math-intrinsics@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/math-intrinsics/-/math-intrinsics-1.1.0.tgz#a0dd74be81e2aa5c2f27e65ce283605ee4e2b7f9"
@@ -1718,6 +1800,14 @@ possible-typed-array-names@^1.0.0, possible-typed-array-names@^1.1.0:
resolved "https://registry.yarnpkg.com/possible-typed-array-names/-/possible-typed-array-names-1.1.0.tgz#93e3582bc0e5426586d9d07b79ee40fc841de4ae"
integrity sha512-/+5VFTchJDoVj3bhoqi6UeymcD00DAwb1nJwamzPvHEszJ4FpF6SNNbUbOS8yI56qHzdV8eK0qEfOSiodkTdxg==
postcss-selector-parser@6.0.10:
version "6.0.10"
resolved "https://registry.yarnpkg.com/postcss-selector-parser/-/postcss-selector-parser-6.0.10.tgz#79b61e2c0d1bfc2602d549e11d0876256f8df88d"
integrity sha512-IQ7TZdoaqbT+LCpShg46jnZVlhWD2w6iQYAcYXfHARZ7X1t/UGhhceQDs5X0cGqKvYlHNOuv7Oa1xmb0oQuA3w==
dependencies:
cssesc "^3.0.0"
util-deprecate "^1.0.2"
postcss@^8.5.25:
version "8.5.26"
resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.5.26.tgz#6e75135780c7e10df3433bf2266c552d35c8c620"
@@ -2155,6 +2245,11 @@ unbox-primitive@^1.1.0:
has-symbols "^1.1.0"
which-boxed-primitive "^1.1.1"
util-deprecate@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf"
integrity sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==
uuid@10.0.0:
version "10.0.0"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-10.0.0.tgz#5a95aa454e6e002725c79055fd42aaba30ca6294"