Skip to main content

An Optimal Strategy for Static Black-Peg Mastermind with Two Pegs

  • Conference paper
  • First Online:
Book cover Combinatorial Optimization and Applications (COCOA 2016)

Part of the book series: Lecture Notes in Computer Science ((LNTCS,volume 10043))

Abstract

Mastermind is a famous two-player game which has attracted much attention in literature within the last years. In this work we investigate the static (also called non-adaptive) variant of Mastermind. The principal rule is that the codemaker has to choose a secret consisting of p pegs and c colors for each peg and the codebreaker may give a number of guesses at once, where for each guess he receives information from the codemaker. Using this information he has a final guess for the correct secret. The aim of the game is to minimize the number of guesses. Whereas Goddard has investigated the static version of original Mastermind in 2003, we do such an investigation of its black-peg variant, where the received information consists only of a number of black pegs which corresponds to the number of pegs matching in the corresponding question and the secret. As main result we present a strategy for this game for \(p=2\) pegs and arbitrarily many colors \( c\ge 3 \) colors and prove its feasibility and optimality. Furthermore, by computer search we found optimal strategies for 9 other pairs (pc).

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    Note that the parameter c is reserved for the number of colors. So we use the parameters \(a,b,d,e,\dots \) here.

References

  1. Asuncion, A.U., Goodrich, M.T.: Nonadaptive Mastermind algorithms for string and vector databases, with case studies. IEEE Trans. Knowl. Data Eng. 25(1), 131–144 (2013)

    Article  Google Scholar 

  2. Chen, S.T., Lin, S.S.: Optimal algorithms for \(2 \times n\) AB games - a graph-partition approach. J. Inf. Sci. Eng. 20(1), 105–126 (2004)

    MathSciNet  Google Scholar 

  3. Chen, S.T., Lin, S.S., Huang, L.T.: Optimal algorithms for \(2 \times n\) Mastermind games - a graph-partition approach. Comput. J. 47(5), 602–611 (2004)

    Article  Google Scholar 

  4. Chvátal, V.: Mastermind. Combinatorica 3, 325–329 (1983)

    Article  MathSciNet  MATH  Google Scholar 

  5. Doerr, B., Spöhel, R., Thomas, H., Winzen, C.: Playing Mastermind with many colors. In: Proceedings of 24th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA 2013), SIAM, pp. 695–704 (2013)

    Google Scholar 

  6. Doerr, B., Winzen, C.: Playing Mastermind with constant-size memory. Theory Comput. Syst. 55(4), 658–684 (2014)

    Article  MathSciNet  MATH  Google Scholar 

  7. Focardi, R., Luccio, F.L.: Guessing bank PINs by winning a Mastermind game. Theory Comput. Syst. 50(1), 52–71 (2012)

    Article  MathSciNet  MATH  Google Scholar 

  8. Gagneur, J., Elze, M.C., Tresch, A.: Selective phenotyping, entropy reduction and the Mastermind game. BMC Bioinform. (BMCBI) 12, 406 (2011)

    Article  Google Scholar 

  9. Goddard, W.: Static Mastermind. J. Combin. Math. Combin. Comput. 47, 225–236 (2003)

    MathSciNet  MATH  Google Scholar 

  10. Goddard, W.: Mastermind revisited. J. Combin. Math. Combin. Comput. 51, 215–220 (2004)

    MathSciNet  MATH  Google Scholar 

  11. Goodrich, M.T.: On the algorithmic complexity of the Mastermind game with black-peg results. Inf. Process. Lett. 109(13), 675–678 (2009)

    Article  MathSciNet  MATH  Google Scholar 

  12. Jäger, G., Peczarski, M.: The number of pessimistic guesses in Generalized Mastermind. Inf. Process. Lett. 109(12), 635–641 (2009)

    Article  MathSciNet  MATH  Google Scholar 

  13. Jäger, G., Peczarski, M.: The number of pessimistic guesses in Generalized black-peg Mastermind. Inf. Process. Lett. 111(19), 933–940 (2011)

    Article  MathSciNet  MATH  Google Scholar 

  14. Jäger, G., Peczarski, M.: Playing several variants of Mastermind with constant-size memory is not harder than with unbounded memory. In: Kratochvíl, J., Miller, M., Froncek, D. (eds.) IWOCA 2014. LNCS, vol. 8986, pp. 188–199. Springer, Heidelberg (2015). doi:10.1007/978-3-319-19315-1_17

    Chapter  Google Scholar 

  15. Jäger, G., Peczarski, M.: The worst case number of questions in generalized AB game with and without white-peg answers. Discret. Appl. Math. 184, 20–31 (2015)

    Article  MathSciNet  MATH  Google Scholar 

  16. Jäger, G., Peczarski, M.: Bounding memory for Mastermind might not make it harder. Theoret. Comput. Sci. 596, 55–66 (2015)

    Article  MathSciNet  MATH  Google Scholar 

  17. Knuth, D.E.: The computer as Mastermind. J. Recr. Math. 9, 1–6 (1976)

    MathSciNet  Google Scholar 

  18. Koyama, K., Lai, T.W.: An optimal Mastermind strategy. J. Recr. Math. 25(4), 251–256 (1993)

    MATH  Google Scholar 

  19. Stuckman, J., Zhang, G.Q.: Mastermind is NP-complete. INFOCOMP J. Comput. Sci. 5, 25–28 (2006)

    Google Scholar 

  20. Viglietta, G.: Hardness of Mastermind. In: Kranakis, E., Krizanc, D., Luccio, F. (eds.) FUN 2012. LNCS, vol. 7288, pp. 368–378. Springer, Heidelberg (2012)

    Chapter  Google Scholar 

  21. Source code of the computer program of this article. http://snovit.math.umu.se/~gerold/source_code_static_mastermind.tar.gz

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Gerold Jäger .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2016 Springer International Publishing AG

About this paper

Cite this paper

Jäger, G. (2016). An Optimal Strategy for Static Black-Peg Mastermind with Two Pegs. In: Chan, TH., Li, M., Wang, L. (eds) Combinatorial Optimization and Applications. COCOA 2016. Lecture Notes in Computer Science(), vol 10043. Springer, Cham. https://doi.org/10.1007/978-3-319-48749-6_48

Download citation

  • DOI: https://doi.org/10.1007/978-3-319-48749-6_48

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-319-48748-9

  • Online ISBN: 978-3-319-48749-6

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics