Skip to main content
QUICK REVIEW

[Paper Review] An experimental study of exhaustive solutions for the Mastermind puzzle

J. J. Merelo, Antonio M. Mora|arXiv (Cornell University)|Jul 5, 2012
Artificial Intelligence in GamesComputer Science2 references6 citations
TL;DR

This paper proposes and evaluates new exhaustive search strategies for the Mastermind puzzle by emphasizing the critical role of including the actual solution in candidate move sets, showing that methods prioritizing this factor outperform classical approaches. The authors introduce hybrid scoring techniques combining Entropy and Most Parts, achieving performance comparable to state-of-the-art methods while offering better suitability for non-exhaustive algorithms like evolutionary strategies.

ABSTRACT

Mastermind is in essence a search problem in which a string of symbols that is kept secret must be found by sequentially playing strings that use the same alphabet, and using the responses that indicate how close are those other strings to the secret one as hints. Although it is commercialized as a game, it is a combinatorial problem of high complexity, with applications on fields that range from computer security to genomics. As such a kind of problem, there are no exact solutions; even exhaustive search methods rely on heuristics to choose, at every step, strings to get the best possible hint. These methods mostly try to play the move that offers the best reduction in search space size in the next step; this move is chosen according to an empirical score. However, in this paper we will examine several state of the art exhaustive search methods and show that another factor, the presence of the actual solution among the candidate moves, or, in other words, the fact that the actual solution has the highest score, plays also a very important role. Using that, we will propose new exhaustive search approaches that obtain results which are comparable to the classic ones, and besides, are better suited as a basis for non-exhaustive search strategies such as evolutionary algorithms, since their behavior in a series of key indicators is better than the classical algorithms.

Motivation & Objective

  • To investigate the impact of including the true solution within candidate moves on exhaustive search performance in Mastermind.
  • To evaluate whether heuristic-based search reduction strategies alone are sufficient, or if solution inclusion is a decisive factor.
  • To develop and test new exhaustive search methods that are more suitable as foundations for non-exhaustive metaheuristics such as evolutionary algorithms.
  • To propose a new empirical evaluation metric—probability of drawing the secret code—as a complement to search space reduction in algorithm design.
  • To assess the scalability and computational feasibility of exhaustive methods for larger problem instances, and to guide future non-exhaustive approaches.

Proposed method

  • Empirically compare multiple exhaustive search algorithms using consistent set pruning and move selection based on heuristic scores.
  • Introduce a hybrid scoring function combining Entropy and Most Parts heuristics to prioritize moves that reduce search space and increase solution inclusion.
  • Implement Plus2, a new method that explicitly favors moves containing the actual solution when possible, improving robustness.
  • Measure algorithm performance using three metrics: average number of moves, search space reduction, and probability of selecting the secret code as a candidate move.
  • Use empirical testing on small problem instances (κ=6,ℓ=4 and κ=8,ℓ=4) to validate the effectiveness of new strategies.
  • Propose that future non-exhaustive methods (e.g., evolutionary algorithms) should use the new scoring functions and sample size heuristics informed by consistent set size.

Experimental results

Research questions

  • RQ1Does including the true solution among candidate moves significantly improve exhaustive search performance in Mastermind?
  • RQ2How does the probability of selecting the secret code as a move compare to traditional search space reduction heuristics in guiding algorithm efficiency?
  • RQ3Can hybrid scoring strategies combining Entropy and Most Parts outperform classical exhaustive methods in terms of solution speed and robustness?
  • RQ4To what extent do the new methods scale to larger problem instances (e.g., κ=8,ℓ=4), and what are the computational bottlenecks?
  • RQ5How can the findings be leveraged to improve non-exhaustive search strategies such as evolutionary algorithms in solving larger Mastermind instances?

Key findings

  • The presence of the true solution among candidate moves significantly improves search performance, as it ensures the highest possible score and increases the likelihood of immediate success.
  • The Plus2 method, which prioritizes moves containing the actual solution, performs as well as or better than the best classical methods across tested problem sizes.
  • Hybrid scoring using both Entropy and Most Parts heuristics yields better results than using either alone, especially in reducing search space while maintaining solution inclusion.
  • The probability of drawing the secret code as a candidate move is a critical, previously underappreciated metric that should be considered alongside search space reduction in algorithm design.
  • For κ=6,ℓ=4, the algorithm runs in ~0.5 seconds; for κ=8,ℓ=4, it takes ~5 seconds, indicating a non-linear time increase due to quadratic comparisons in the consistent set.
  • The consistent set size grows with problem size, but so does the probability of including the true solution, suggesting a complex trade-off that affects scalability and future algorithm design.

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.