International Workshop on Combinatorial Algorithms

IWOCA 2014: Combinatorial Algorithms pp 188-199 | Cite as

Playing Several Variants of Mastermind with Constant-Size Memory is not Harder than with Unbounded Memory

  • Gerold Jäger
  • Marcin PeczarskiEmail author
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 8986)


We investigate a version of the Mastermind game, where the codebreaker may only store a constant number of questions and answers, called Constant-Size Memory Mastermind, which was recently introduced by Doerr and Winzen. We concentrate on the most difficult case, where the codebreaker may store only one question and one answer, called Size-One Memory Mastermind. We consider two variants of the game: the original one, where the answer is coded with white and black pegs, and the simplified one, where only black pegs are used in the answer. We show that for two pegs and an arbitrary number of colors, the number of questions needed by the codebreaker in an optimal strategy in the worst case for these games is equal to the corresponding number of questions in the games without a memory restriction. In other words, for these cases restricting the memory size does not make the game harder for the codebreaker. This is a continuation of a result of Doerr and Winzen, who showed that this holds asymptotically for a fixed number of colors and an arbitrary number of pegs. Furthermore, by computer search we determine additional pairs (pc), where again the numbers of questions in an optimal strategy in the worst case for Size-One Memory Mastermind and original Mastermind are equal.


Game theory Logic game Mastermind Space complexity 


  1. 1.
    Chen, S.T., Lin, S.S.: Optimal algorithms for \(2 \times n\) AB games–a graph-partition approach. J. Inform. Sci. Eng. 20(1), 105–126 (2004)Google Scholar
  2. 2.
    Chen, S.T., Lin, S.S.: Optimal algorithms for \(2 \times n\) Mastermind games–a graph-partition approach. Comput. J. 47(5), 602–611 (2004)CrossRefGoogle Scholar
  3. 3.
    Chvátal, V.: Mastermind. Combinatorica 3(3–4), 325–329 (1983)zbMATHMathSciNetCrossRefGoogle Scholar
  4. 4.
    Doerr, B., Spöhel, R., Thomas, H., Winzen, C.: Playing mastermind with many colors. In: Proceedings of the 24th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA 2013), SIAM, pp. 695–704 (2013)Google Scholar
  5. 5.
    Doerr, B., Winzen, C.: Memory-restricted black-box complexity of OneMax. Inform. Process. Lett. 112(1–2), 32–34 (2012)zbMATHMathSciNetCrossRefGoogle Scholar
  6. 6.
    Doerr, B., Winzen, C.: Playing Mastermind with constant-size memory. In: Proceedings of 29th International Symposium on Theoretical Aspects of Computer Science (STACS 2012). Leibniz International Proceedings in Informatics (LIPIcs), vol. 14, pp. 441–452. Schloss Dagstuhl - Leibniz-Zentrum für Informatik (2012)Google Scholar
  7. 7.
    Doerr, B., Winzen, C.: Playing Mastermind with constant-size memory. Theory Comput. Syst. 55(4), 658–684 (2014)zbMATHMathSciNetCrossRefGoogle Scholar
  8. 8.
    Droste, S., Jansen, T., Wegener, I.: Upper and lower bounds for randomized search heuristics in black-box optimization. Theory Comput. Syst. 39(4), 525–544 (2006)zbMATHMathSciNetCrossRefGoogle Scholar
  9. 9.
    Erdős, P., Rényi, A.: On two problems of information theory. Magyar Tud. Akad. Mat. Kutató Int. Közl. 8, 229–243 (1963)Google Scholar
  10. 10.
    Goddard, W.: Static Mastermind. J. Combin. Math. Combin. Comput. 47, 225–236 (2003)zbMATHMathSciNetGoogle Scholar
  11. 11.
    Goodrich, M.T.: On the algorithmic complexity of the Mastermind game with black-peg results. Inform. Process. Lett. 109(13), 675–678 (2009)zbMATHMathSciNetCrossRefGoogle Scholar
  12. 12.
    Jäger, G., Peczarski, M.: The number of pessimistic guesses in Generalized Mastermind. Inform. Process. Lett. 109(12), 635–641 (2009)zbMATHMathSciNetCrossRefGoogle Scholar
  13. 13.
    Jäger, G., Peczarski, M.: The number of pessimistic guesses in Generalized Black-peg Mastermind. Inform. Process. Lett. 111(19), 933–940 (2011)zbMATHMathSciNetCrossRefGoogle Scholar
  14. 14.
    Jäger, G., Peczarski, M.: The worst case number of questions in Generalized AB game with and without white-peg answers. Discrete Appl. Math. 184, 20–31 (2015)MathSciNetCrossRefGoogle Scholar
  15. 15.
    Knuth, D.E.: The computer as Mastermind. J. Recr. Math. 9(1), 1–6 (1976–1977)Google Scholar
  16. 16.
    Koyama, K., Lai, T.W.: An optimal Mastermind strategy. J. Recr. Math. 25(4), 251–256 (1993)zbMATHGoogle Scholar

Copyright information

© Springer International Publishing Switzerland 2015

Authors and Affiliations

  1. 1.Department of Mathematics and Mathematical StatisticsUniversity of UmeåUmeåSweden
  2. 2.Institute of InformaticsUniversity of WarsawWarszawaPoland

Personalised recommendations