Skip to main content
QUICK REVIEW

[Paper Review] Finding a Winning Strategy for Wordle is NP-complete

Will Rosenbaum|arXiv (Cornell University)|Apr 8, 2022
Algorithms and Data CompressionComputer Science7 citations
TL;DR

This paper formally defines Wordle as a computational decision problem and proves that determining whether a winning strategy exists for a given Wordle instance is NP-complete. The authors establish NP-hardness via a reduction from the minimum dominating set problem and show that a winning strategy can be verified in polynomial time using a strategy tree data structure, confirming membership in NP.

ABSTRACT

In this paper, we give a formal definition of the popular word-guessing game Wordle. We show that, in general, determining if a given Wordle instance admits a winning strategy is NP-complete. We also show that given a Wordle instance of size $N$, a winning strategy that uses $g$ guesses in the worst case (if any) can be found in time $N^{O(g)}$.

Motivation & Objective

  • To formally define Wordle as a computational problem with a precise input model, including target word lists, allowed guesses, and game length.
  • To investigate the computational complexity of determining whether a winning strategy exists for a given Wordle instance.
  • To establish that the problem of deciding if a winning strategy exists is NP-complete, thereby placing it in a well-known complexity class.
  • To show that for fixed game length g, an optimal winning strategy can be found in time |WI|^{O(g)}, which is polynomial when g is constant.
  • To extend the NP membership result to cases where the dictionary of allowed guesses is defined implicitly (e.g., via a finite automaton), even when its size is exponential.

Proposed method

  • Define a Wordle instance WI = (Σ, d, D, W, g), where Σ is the alphabet, d is word length, D is the dictionary of allowed guesses, W is the list of possible target words, and g is the maximum number of guesses.
  • Introduce a feedback oracle Ω_w(u) that returns a d-length vector in {0,1,2}^d, encoding letter position matches, partial matches, and non-matches, with special handling for repeated letters.
  • Formalize a strategy as a deterministic function mapping sequences of queries and responses to the next query, with success defined as identifying the target word within g guesses.
  • Represent strategies using strategy trees, where each node corresponds to a query and each edge to a possible feedback response, with depth bounded by g.
  • Prove NP-hardness by reducing the minimum dominating set (MDS) problem to the WinningStrategy decision problem, constructing a Wordle instance from a graph such that a winning strategy exists iff the graph has a dominating set of size ≤ K.
  • Prove NP-membership by showing that a strategy tree of polynomial size can serve as a certificate, and that the validity of the tree (including correct filtering of possible targets at each node) can be verified in polynomial time.

Experimental results

Research questions

  • RQ1Is the problem of determining whether a winning strategy exists for a given Wordle instance computationally hard?
  • RQ2Can the existence of a winning strategy be verified efficiently, and does it lie in NP?
  • RQ3What is the computational complexity of finding an optimal winning strategy when the game length g is fixed?
  • RQ4Does the NP-completeness result hold when the set of allowed guesses is defined implicitly (e.g., via a finite automaton), rather than explicitly?

Key findings

  • The decision problem WinningStrategy — determining whether a winning strategy exists for a given Wordle instance — is NP-complete.
  • The NP-hardness of WinningStrategy is established via a reduction from the minimum dominating set problem, showing that solving Wordle strategy problems is at least as hard as solving MDS.
  • The problem is in NP because a winning strategy can be represented as a strategy tree of polynomial size, and the correctness of the tree can be verified in polynomial time using a filtering procedure.
  • For any Wordle instance with fixed game length g, an optimal winning strategy can be found in |WI|^{O(g)} time, which is polynomial when g is a constant.
  • The NP-membership result extends to generalized Wordle instances where the dictionary D is defined implicitly (e.g., by a finite automaton), even when |D| is exponential in the input size.
  • The result confirms that the problem remains in NP even under the more general model considered in Open Problem 3 of Lokshtanov and Subercaseaux (2022), resolving their Open Problem 1.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.