Skip to main content

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

  • Conference paper
  • First Online:
Book cover Algorithmic Game Theory (SAGT 2018)

Part of the book series: Lecture Notes in Computer Science ((LNISA,volume 11059))

Included in the following conference series:

Abstract

Mastermind is a famous game played by a codebreaker against a codemaker. We investigate its static (also called non-adaptive) black-peg variant. Given c colors and p pegs, the codemaker has to choose a secret, a p-tuple of c colors, and the codebreaker asks a set of questions all at once. Like the secret, a question is a p-tuple of c colors. The codemaker then tells the codebreaker how many pegs in each question are correct in position and color. Then the codebreaker has one final question to find the secret. His aim is to use as few of questions as possible. Our main result is an optimal strategy for the codebreaker for \(p=3\) pegs and an arbitrary number c of colors using \( \lfloor 3c/2 \rfloor +1\) questions.

A reformulation of our result is that the metric dimension of \( \mathbb {Z}_n \times \mathbb {Z}_n \times \mathbb {Z}_n\) is equal to \( \lfloor 3n/2 \rfloor \).

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 in [6] the final question was not taken into account.

  2. 2.

    The case \(p=1\) is trivial for both games: exactly c questions are needed.

  3. 3.

    For \(c=4\), this strategy with 6 questions is not feasible, as the shifting step does not work. However, changing peg 3 of the third question from color 4 to color 3 leads to a feasible strategy with 6 questions.

  4. 4.

    For \(c=1\), this strategy with 1 question is not defined, and the strategy with 0 questions (i.e., only the final question) is optimal.

References

  1. Blumenthal, L.M.: Theory and Applications of Distance Geometry. Clarendon Press, Oxford (1953)

    MATH  Google Scholar 

  2. Cáceres, J., Hernando, C., Mora, M., Pelayo, I.M., Puertas, M.L., Seara, C., Wood, D.R.: On the metric dimension of cartesian products of graphs. SIAM J. Discrete Math. 21(2), 423–441 (2007)

    Article  MathSciNet  Google Scholar 

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

    Article  MathSciNet  Google Scholar 

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

    Article  Google Scholar 

  5. Glazik, C., Jäger, G., Schiemann, J., Srivastav, A.: Bounds for static black-peg AB mastermind. In: Gao, X., Du, H., Han, M. (eds.) COCOA 2017. LNCS, vol. 10628, pp. 409–424. Springer, Cham (2017). https://doi.org/10.1007/978-3-319-71147-8_28

    Chapter  Google Scholar 

  6. Goddard, W.: Static mastermind. J. Comb. Math. Comb. Comput. 47, 225–236 (2003)

    MathSciNet  MATH  Google Scholar 

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

    MathSciNet  MATH  Google Scholar 

  8. 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  Google Scholar 

  9. Jäger, G.: An optimal strategy for static black-peg mastermind with two pegs. In: Chan, T.-H.H., Li, M., Wang, L. (eds.) COCOA 2016. LNCS, vol. 10043, pp. 670–682. Springer, Cham (2016). https://doi.org/10.1007/978-3-319-48749-6_48

    Chapter  Google Scholar 

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

    Article  MathSciNet  Google Scholar 

  11. 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  Google Scholar 

  12. 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)

    Article  MathSciNet  Google Scholar 

  13. Söderberg, S., Shapiro, H.S.: A combinatory detection problem. Am. Math. Mon. 70(10), 1066–1070 (1963)

    Article  MathSciNet  Google Scholar 

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

    Google Scholar 

  15. Source code of the computer program of this article. http://snovit.math.umu.se/~gerold/source_code_static_black_peg_mastermind_three_pegs.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

© 2018 Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Jäger, G., Drewes, F. (2018). An Optimal Strategy for Static Black-Peg Mastermind with Three Pegs. In: Deng, X. (eds) Algorithmic Game Theory. SAGT 2018. Lecture Notes in Computer Science(), vol 11059. Springer, Cham. https://doi.org/10.1007/978-3-319-99660-8_25

Download citation

  • DOI: https://doi.org/10.1007/978-3-319-99660-8_25

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-319-99659-2

  • Online ISBN: 978-3-319-99660-8

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics