Playing Mastermind With Many Colors

We analyze the general version of the classic guessing game Mastermind with n positions and k colors. Since the case k ≤ n1 − ε, ε > 0 a constant, is well understood, we concentrate on larger numbers of colors. For the most prominent case k = n, our results imply that Codebreaker can find the secret code with O(nlog log n) guesses. This bound is valid also when only black answer pegs are used. It improves the O(nlog n) bound first proven by Chvátal. We also show that if both black and white answer pegs are used, then the O(nlog log n) bound holds for up to n2log log n colors. These bounds are almost tight, as the known lower bound of Ω(n) shows. Unlike for k ≤ n1 − ε, simply guessing at random until the secret code is determined is not sufficient. In fact, we show that an optimal nonadaptive strategy (deterministic or randomized) needs Θ(nlog n) guesses.

[1]  Nader H. Bshouty,et al.  Optimal Algorithms for the Coin Weighing Problem with a Spring Scale , 2009, COLT.

[2]  D. Knuth The Computer as Master Mind , 1977 .

[3]  Guo-Qiang Zhang,et al.  Mastermind is NP-Complete , 2005, ArXiv.

[4]  Michael T. Goodrich,et al.  The Mastermind Attack on Genomic Data , 2009, 2009 30th IEEE Symposium on Security and Privacy.

[5]  Alexandre Temporel A heuristic hill climbing algorithm for Mastermind , .

[6]  Wayne Goddard Static Mastermind , 2003 .

[7]  H. S. Shapiro,et al.  A Combinatory Detection Problem , 1963 .

[8]  K. Koyama,et al.  An Optimal Mastermind Strategy , 1993 .

[9]  Philippe Jacquet,et al.  Entropy Computations via Analytic Depoissonization , 1999, IEEE Trans. Inf. Theory.

[10]  Wayne Goddard,et al.  Mastermind Revisited , 2004 .

[11]  Juan Julián Merelo Guervós,et al.  Improving and Scaling Evolutionary Approaches to the MasterMind Problem , 2011, EvoApplications.

[12]  Dries R. Goossens,et al.  Efficient solutions for Mastermind using genetic algorithms , 2009, Comput. Oper. Res..

[13]  Juan Julián Merelo Guervós,et al.  Optimizing worst-case scenario in evolutionary solutions to the MasterMind puzzle , 2011, 2011 IEEE Congress of Evolutionary Computation (CEC).

[14]  Joel H. Spencer,et al.  Randomization, Derandomization and Antirandomization: Three Games , 1994, Theor. Comput. Sci..

[15]  Benjamin Doerr,et al.  Playing Mastermind with Constant-Size Memory , 2012, Theory of Computing Systems.

[16]  Paul Erdgs,et al.  ON TWO PROBLEMS OF INFORMATION THEORY bY PAUL ERDGS and ALFRJ~D RgNYI , 2001 .

[17]  Gerold Jäger,et al.  The number of pessimistic guesses in Generalized Black-peg Mastermind , 2011, Inf. Process. Lett..

[18]  Gerold Jäger,et al.  The number of pessimistic guesses in Generalized Mastermind , 2009, Inf. Process. Lett..

[19]  Andrzej Pelc,et al.  Searching games with errors - fifty years of coping with liars , 2002, Theor. Comput. Sci..

[20]  Robin A. Moser A constructive proof of the Lovász local lemma , 2008, STOC '09.

[21]  Vasek Chvátal,et al.  Mastermind , 1983, Comb..

[22]  Flaminia L. Luccio,et al.  Cracking Bank PINs by Playing Mastermind , 2010, FUN.

[23]  Vladimir Grebinski,et al.  Optimal Reconstruction of Graphs under the Additive Model , 1997, Algorithmica.

[24]  Zhixiang Chen,et al.  Finding a Hidden Code by Asking Questions , 1996, COCOON.

[25]  Thomas Jansen,et al.  UNIVERSITY OF DORTMUND REIHE COMPUTATIONAL INTELLIGENCE COLLABORATIVE RESEARCH CENTER 531 Design and Management of Complex Technical Processes and Systems by means of Computational Intelligence Methods Upper and Lower Bounds for Randomized Search Heuristics in Black-Box Optimization , 2004 .

[26]  Giovanni Viglietta,et al.  Hardness of Mastermind , 2011, FUN.

[27]  W. H. Mills,et al.  Determination of a Subset from Certain Combinatorial Properties , 1966, Canadian Journal of Mathematics.

[28]  Dan Suciu,et al.  Journal of the ACM , 2006 .

[29]  Michael T. Goodrich,et al.  On the algorithmic complexity of the Mastermind game with black-peg results , 2009, Inf. Process. Lett..

[30]  Tom Kalisker,et al.  Solving Mastermind Using Genetic Algorithms , 2003, GECCO.

[31]  B. Lindström On a Combinatorial Problem in Number Theory , 1965, Canadian Mathematical Bulletin.