Abstract
Mastermind is a famous two-player deduction game. A Codemaker chooses a secret code and a Codebreaker tries to guess this secret code in as few guesses as possible, with feedback information after each guess. Many existing works have computed optimal worst-case and average-case strategies of the Codebreaker, assuming that the Codemaker chooses the secret code uniformly at random. However, the Codemaker can freely choose any distribution probability on the secret codes. An optimal strategy in this more general setting is known as a Nash Equilibrium. In this research, we compute such a Nash Equilibrium for all instances of Mastermind up to the most classical instance of 4 pegs and 6 colors, showing that the uniform distribution is not always the best choice for the Codemaker. We also show the direct relation between Nash Equilibrium computations and computations of worst-case and average-case strategies.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Similar content being viewed by others
Notes
- 1.
The straightforward proof is left to the reader.
- 2.
We use (b, w) since the original game use black and white pins to display the grade.
- 3.
A unicolor (resp. bicolor) code is a code with both pegs with same (resp. different) color. There are 3 unicolor codes and 6 bicolor codes. Note that \(3\times \frac{1}{6}+6\times \frac{1}{12}=1\).
- 4.
This formula is incorrect when \(k=1\) since there exists a single code, hence a single possible grade (n, 0). For \(k=2\) colors, there are also some unreachable grades such as \((b,w)=(0,n)\) when n is odd.
- 5.
To compute WC and AVG, it is sufficient to consider only pure strategies. However for NE, it is required to consider also mixed strategies.
- 6.
Pure strategies of the Codemaker are trivially computed. There are exactly \(k^n\) pure strategies, one for each possible code.
- 7.
- 8.
A full description will be given in a longer version of this article.
- 9.
Fortunately, \(4\times 0 + 48\times \frac{2}{345} + 36\times \frac{1}{276} + 144\times \frac{1}{276} + 24\times \frac{1}{345}=1\).
- 10.
We could not prove yet the uniqueness for instances (5, 3), (4, 5), and (4, 6), but it should be obtained very soon.
References
Chen, S.T., Lin, S.S.: Optimal algorithms for \(2\times n\) mastermind games-a graph-partition approach. Comput. J. 47, 602–611 (2004)
Chvátal, V.: Mastermind. Combinatorica 3, 325–329 (1983)
Doerr, B., Sphel, R., Thomas, H., Winzen, C.: Playing mastermind with many colors. In: Proceedings of the 24th Annual ACM-SIAM Symposium on Discrete Algorithms, pp. 695–704 (2013)
Goddard, W.: Static mastermind. J. Comb. Math. Comb. Comput. 47, 225–236 (2003)
Goddard, W.: Mastermind revisited. J. Comb. Math. Comb. Comput. 51, 215–220 (2004)
Goodrich, M.T.: On the algorithmic complexity of the mastermind game with black-peg results. Inform. Process. Lett. 109, 675–678 (2009)
Jäger, G., Peczarski, M.: The number of pessimistic guesses in generalized mastermind. Inform. Process. Lett. 109, 635–641 (2009)
Jäger, G., Peczarski, M.: The number of pessimistic guesses in generalized black-peg mastermind. Inform. Process. Lett. 111, 933–940 (2011)
Knuth, D.E.: The computer as master mind. J. Recreational Math. 9, 1–6 (1976)
Koyama, K., Lai, T.: An optimal mastermind strategy. J. Recreational Math. 25, 251–256 (1993)
Nash, J.F.: Non-Cooperative Games. Ph.D. thesis, Princeton University (1950)
Pearson, K.R.: Reducing two person, zero sum games with underlying symmetry. J. Aust. Math. Soc. (Ser. A) 33, 152–161 (1982)
Ville, G.: An optimal mastermind \((4,7)\) strategy and more results in the expected case, May 2013, eprint arXiv:1305.1010
Wiener, M.: Re: sci.math faq: Master mind, post in sci.math newsgroups on 29 Nov 1995 at 20: 44: 49
Acknowledgments
This research was supported in part by JSPS KAKENHI Grant Number 26870228.
Author information
Authors and Affiliations
Corresponding authors
Editor information
Editors and Affiliations
A Example for Game Instance \((n,k)=(3,3)\)
A Example for Game Instance \((n,k)=(3,3)\)
Rights and permissions
Copyright information
© 2016 Springer International Publishing AG
About this paper
Cite this paper
Bonnet, F., Viennot, S. (2016). Nash Equilibrium in Mastermind. In: Plaat, A., Kosters, W., van den Herik, J. (eds) Computers and Games. CG 2016. Lecture Notes in Computer Science(), vol 10068. Springer, Cham. https://doi.org/10.1007/978-3-319-50935-8_11
Download citation
DOI: https://doi.org/10.1007/978-3-319-50935-8_11
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-319-50934-1
Online ISBN: 978-3-319-50935-8
eBook Packages: Computer ScienceComputer Science (R0)