Abstract
MasterMind is a game in which the player must find out, by making guesses, a hidden combination of colors set by the opponent. The player lays a combination of colors, and the opponent points out the number of positions the player has found out (black tokens) and the number of colors that are in a different place from the hidden combination (white tokens). This problem can be formulated in the following way: the target of the game is to find a string composed of l symbols, drawn from an alphabet of cardinality c, using as constraints hints that restrict the search space. The partial objective of the search is to find a string that meets all the constraints made so far the final objective being to find the hidden string.This problem can also be located within the class of constrained optimization, although in this case not all the constraints are known in advance; hence its dynamic nature.Three algorithms playing MasterMind have been evaluated with respect to the number of guesses made by each one and the number of combinations examined before finding the solution: a random-search-with-constraints algorithm, simulated annealing, and a genetic algorithm. The random search and genetic algorithm at each step plays the optimal solution i.e., the one that is consistent with the constraints made so far, while simulated annealing plays the best found within certain time constraints. This paper proves that the algorithms that follow the optimal strategy behave similarly, getting the correct combination in more or less the same number of guesses; between them, GA is better with respect to the number of combinations examined, and this difference increases with the size of the search space, while SA is much faster (around 2 orders of magnitude) and gives a good enough answer.
Preview
Unable to display preview. Download preview PDF.
References
Melle Koning. Mastermind. newsgroup comp.ai.games, archived at http://www.krl.caltech.edu/∼brown/alife/news/ai-games-html/0370.html.
Tim Cooper. Mastermind. newsgroup comp.ai.games, archived at http://www.krl.caltech.edu/∼brown/alife/news/ai-games-html/0313.html.
Donald E. Knuth. The computer as Master Mind. J. Recreational Mathematics, (9):1–6, 1976–77.
Kenji Koyama; T. W. Lai. An optimal Mastermind strategy. J. Recreational Mathematics, 1994.
E. Neuwirth. Some strategies for mastermind. Zeitschrift fur Operations Research. Serie B, 26(8):B257–B278, 1982.
D. Viaud. Une strategie generale pour jouer au Mastermind. RAIRO-Recherche Operationelle, 21(1):87–100, 1987.
D. Viaud. Une formalisation du jeu de Mastermind. RAIRO-Recherche Operationelle, 13(3):307–321, 1979.
Leon Sterling; Ehud Shapiro. The Art of Prolog: Advanced Programming Techniques. MIT press, 1986.
V. Chvatal. Mastermind. Combinatorica, 3(3–4):325–329, 1983.
Risto Widenius. Mastermind. newsgroup comp.ai.games, archived at http://www.krl.caltech.edu/∼brown/alife/news/ai-games-html/1311.html.
Zbigniew Michalewicz. Genetic Algorithms+Data Structures=Evolution programs. Springer-Verlag, 2nd edition edition, 1994.
Marc Schoenauer; Spyros Xanthakis. Constrained GA optimization. In Forrest [25], pages 573–580.
John J. Grefenstette. Genetic algorithms for changing environments. In R. Maenner; B. Manderick, editor, Parallel Problem Solving from Nature, 2, pages 137–144. Elsevier Science Publishers B. V., 1992.
Helen G. Cobb; John J. Grefenstette. Genetic algorithms for tracking changing environments. In Forrest [25], pages 523–530.
A. Barak J. Maresky; Y. Davidor; D. Gitler; G. Aharoni. Selective destructive re-start. In Eshelman [26], pages 144–150.
David E. Goldberg. Zen and the art of genetic algorithms. In J. David Schaffer, editor, Procs. of the 3rd Int. Conf. on Genetic Algorithms, ICGA89, pages 80–85. Morgan Kauffmann, 1989.
Conor Ryan. Advances in Genetic Programming, chapter Pygmies and Civil Servants. MIT press, 1992.
J. J. Merelo. Genetic Mastermind, a case of dynamic constraint optimization. GeNeura Technical Report G-96-1, Universidad de Granada, 1996.
Bryant A. Julstrom. What have you done for me lately? Adapting operator probabilities in a steady-state Genetic Algorithm. In Eshelman [26], pages 81–87.
John J. Holland. Adaptation in Natural and Artificial Systems. University of Michigan Press, 1975.
D. B. Fogel. Evolutionary Computation: Towards a New Philosophy of Machine Intelligence. IEEE press, 1995.
J. Aarts, E.; Korst. Simulated Annealing and Boltzmann Machines. John Wiley & Sons, 1989.
C. H. Papadimitriou; K. Steiglitz. Combinatorial Optimization: Algorithms and Complexity. Prentice-Hall, New York, 1982.
S. W. Mahfoud; D. E. Goldberg. Parallel recombinative simulated annealing: A genetic algorithm. Technical report, IlliGAL Report no. 92002, Dept. Of General Engineering, UIUC., 1992.
Stephanie Forrest, editor. Proceedings of the 5th International Conference on Genetic Algorithms. Morgan Kaufmann, 1993.
Larry J. Eshelman, editor. Proceedings of the 6th International Conference on Genetic Algorithms. Morgan Kaufmann, 1995.
Author information
Authors and Affiliations
Editor information
Rights and permissions
Copyright information
© 1996 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Bernier, J.L., Herráiz, C.I., Merelo, J.J., Olmeda, S., Prieto, A. (1996). Solving MasterMind using GAs and simulated annealing: A case of dynamic constraint optimization. In: Voigt, HM., Ebeling, W., Rechenberg, I., Schwefel, HP. (eds) Parallel Problem Solving from Nature — PPSN IV. PPSN 1996. Lecture Notes in Computer Science, vol 1141. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-61723-X_1019
Download citation
DOI: https://doi.org/10.1007/3-540-61723-X_1019
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-61723-5
Online ISBN: 978-3-540-70668-7
eBook Packages: Springer Book Archive