Playing Mastermind with Many Colors


We analyze the general version of the classic guessing game Mastermind with <i>n</i> positions and <i>k</i> colors. Since the case <i>k</i> &leq; <i>n</i><sup>1 &minus; &epsiv;</sup>, &epsiv; &gt; 0 a constant, is well understood, we concentrate on larger numbers of colors. For the most prominent case <i>k</i> &equals; <i>n</i>, our results imply that Codebreaker can find the secret code with <i>O</i>(<i>n</i>log log <i>n</i>) guesses. This bound is valid also when only black answer pegs are used. It improves the <i>O</i>(<i>n</i>log <i>n</i>) bound first proven by Chv&#225;tal. We also show that if both black and white answer pegs are used, then the <i>O</i>(<i>n</i>log log <i>n</i>) bound holds for up to <i>n</i><sup>2</sup>log log <i>n</i> colors. These bounds are almost tight, as the known lower bound of &#937;(<i>n</i>) shows. Unlike for <i>k</i> &leq; <i>n</i><sup>1 &minus; &epsiv;</sup>, 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 &Theta;(<i>n</i>log <i>n</i>) guesses.

DOI: 10.1145/2987372

Extracted Key Phrases

1 Figure or Table

Unfortunately, ACM prohibits us from displaying non-influential references for this paper.

To see the full reference list, please visit