[Paper Review] Mastermind is NP-Complete
This paper proves that the Mastermind Satisfiability Problem (MSP) is NP-complete by reducing the NP-hard Vertex-Cover problem to MSP through a polynomial-time transformation. The authors encode graph vertices and edges as colors in a Mastermind instance, using specific guess-response constraints to simulate vertex cover validation, establishing that solving MSP is computationally as hard as solving NP-complete problems.
In this paper we show that the Mastermind Satisfiability Problem (MSP) is NP-complete. The Mastermind is a popular game which can be turned into a logical puzzle called Mastermind Satisfiability Problem in a similar spirit to the Minesweeper puzzle. By proving that MSP is NP-complete, we reveal its intrinsic computational property that makes it challenging and interesting. This serves as an addition to our knowledge about a host of other puzzles, such as Minesweeper, Mah-Jongg, and the 15-puzzle.
Motivation & Objective
- To determine the computational complexity of the Mastermind Satisfiability Problem (MSP), a decision variant of the Mastermind game.
- To show that MSP is NP-complete by reducing it from the known NP-hard Vertex-Cover problem.
- To formalize the Mastermind feedback mechanism using two distance measures: one for correct position (black pegs), another for correct color but wrong position (white pegs).
- To demonstrate that solving MSP is computationally intractable in the general case, despite its intuitive appeal as a logic puzzle.
Proposed method
- Formalize Mastermind using tuples in N^ℓ_κ, where κ is the number of colors and ℓ is the solution length.
- Define the Mastermind score ρ(x, y) = (b, w−b) as a pair of integers: b counts correct color-position matches, w−b counts correct color-wrong position matches.
- Introduce two distance measures: ρ₁(x,y) = ℓ−b (city-block-like) and ρ₂(x,y) = ℓ−w (symmetric difference of multisets), both proven to be valid metrics.
- Construct a polynomial-time reduction from the Vertex-Cover(n) problem to MSP by encoding vertices and edges as distinct colors, using control colors Y and N to constrain solution space.
- Design four types of guesses: all-N (to exclude N from solution), YYY followed by Ns (to fix first three positions as Y), edge-specific guesses (ei,a,b) with score (0,2), and a full vertex guess with score (3,n).
- Prove equivalence: a valid vertex cover exists in the original graph if and only if a solution exists for the constructed MSP instance.
Experimental results
Research questions
- RQ1Is the Mastermind Satisfiability Problem (MSP) computationally hard in the general case?
- RQ2Can the NP-hard Vertex-Cover problem be reduced to MSP in polynomial time?
- RQ3Does the feedback mechanism in Mastermind—comprising black and white pegs—admit a formalization as a pair of distance measures in combinatorial spaces?
- RQ4Can a logical puzzle variant of Mastermind be shown to be NP-complete through a constructive encoding of graph problems?
- RQ5Is the uniqueness of a Mastermind solution decidable with the same complexity as finding the solution itself?
Key findings
- The Mastermind Satisfiability Problem (MSP) is proven to be NP-complete via a polynomial-time reduction from the Vertex-Cover problem.
- The reduction uses κ = #V + #E + 2 colors and ℓ = 3 + 2#V + #E positions, encoding vertices, edges, and control symbols (Y, N) as distinct colors.
- The score constraints (0,0), (3,0), (0,2), and (3,n) enforce structural constraints: N is excluded, first three positions are Y, edge guesses must match two colors in wrong positions, and exactly n vertex colors must appear.
- A solution to the MSP instance exists if and only if the original graph has a vertex cover of size n, establishing the correctness of the reduction.
- The uniqueness of a solution can be verified in polynomial time relative to solving MSP, implying that uniqueness checking is no harder than solution finding.
- The result extends the class of NP-complete puzzles to include Mastermind, joining others like Minesweeper and the 15-puzzle.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.