THINK
You are a senior algorithms engineer and AI tutor.
GOAL
Design, implement, and self-critique an **information-theoretic Wordle solver** that minimizes average guesses.
TASKS
1 ▸ **Algorithm Design**
• Explain—in ≤180 words—the entropy-based strategy you will use to pick each next guess.
• State the theoretical average-guess target you think is achievable on the official 2 315-word answer list.
2 ▸ **Code Implementation**
• Produce fully runnable Python 3 code that
– loads both the 2 315-word answer list and the 12 972-word allowed-guess list (fetch from GitHub raw links).
– pre-computes letter-position frequency tables.
– uses entropy to choose guesses; break ties by alphabetical order.
– runs 100 random games and prints the mean, median, and max guesses.
• Include a main-guard so the script can be imported without executing.
3 ▸ **Complexity & Trade-Off Analysis**
• In ≤120 words, state the time complexity of one round (guess → feedback → next-guess calc) and discuss any big-O vs. constant-factor trade-offs.
4 ▸ **Self-Reflection**
• List the two biggest weaknesses of your implementation and how you would improve them in a v2.
• Identify one alternative heuristic worth benchmarking and why.
5 ▸ **Reasoning Trace**
• Under this heading (≤120 words) expose the key logical steps you followed from task to task.
FORMAT RULES
– Output sections in the order above with clear Markdown H2 headings (##).
– No tables, no prose fluff.
– Keep total output ≤700 words **excluding** the code block.
– The code block must be syntactically valid Python, no ellipses.
DELIVER.
1 Algorithm Design (≤180 words)
At every turn we maintain the current candidate set C of possible answers.
For each legal guess g (the 12 972‑word list) we enumerate the 243 possible
feedback patterns π∈{0,1,2}⁵ (gray, yellow, green).
For a fixed g we count, across C, how many answers yield each pattern:
n₍π₎ = |{ a∈C : pattern(a,g)=π }|.
Let p₍π₎ = n₍π₎/|C|.
The expected information gain (Shannon entropy) is
H(g) = − ∑₍π₎ p₍π₎ log₂ p₍π₎.
We pick the guess with maximum H(g); ties fall to the alphabetically first word.
Using the entire allowed‑guess list (not just C) usually gives higher entropy
early, accelerating convergence.
The process repeats with C filtered to the pattern actually observed until the
answer is found.
Well‑tuned entropy solvers published by the community achieve ≈3.42 mean
guesses over the official 2 315‑word answer list; with no additional pruning
or look‑ahead this is a realistic target for our implementation.