Genetic Mastermind | Mastermind Genético

Write up to 8 digits, from 1 to 9, which will form the hidden combination the program will try to find out. Each digit corresponds to a color peg. The computer will then try to guess the combination you entered.
The game
MasterMind is a game in which a player, the codemaker, sets a combination of color pegs, like this:


The other player, the codebreaker, must find out that combination, by playing his/her own combinations. For each combination the codebreaker plays, the codemaker anwers with small black pegs for each peg that is correctly guessed, and white pegs for each color that is correct, but in the wrong position, in this way:

color2color2color3color1color5color6 [black][black][black][black][white]

Mastermind is © Invicta Plastics Ltd.
The algorithm

Our program uses a evolutionary algorithm to find the solution. It keeps a population of solutions, which are ranked according to their consistency to the answers (black and white pegs) to the guesses already made. When the algorithm finds a solution that is consistent with all guesses, it is played. If you want more information on the actual genetic algorithm used, check the paper (will be available soon).

This program is programmed in C++ using the EO class library. The source code for the program is included as an example in the distribution. At the same time, it's an example of evolving objects, in this case, the object that is evolved is the solution to the mastermind problem itself.

A complete description of the algorithm and some summarized results can be found in this paper, which was accepted as late-breaking paper in the GECCO conference.

Some links
Various and diverse links related to genetic mastermind, classic mastermind and AI mastermind.

Mastermind you can play with

  • Another MasterWeb, a commercial site in which you have to find out the combination set by the computer.

Courses that use mastermind

A bit of science

Some discussions and stuff on mastermind:
  • There's been a good amount of discussion on the USENET newsgroup regarding playing Mastermind using a program.
  • An "interesting pages" link by Jay Scott, including many other games on the Web.

GeNeura Team
Departamento de Arquitectura y Tecnología de los Computadores
Universidad de Granada Granada (España)
Phone: +34-958-243162; Fax: +34-58-248993