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:
     ![[black]](/images/negra.gif) ![[black]](/images/negra.gif) ![[black]](/images/negra.gif) ![[black]](/images/negra.gif) ![[white]](/images/blanca.gif)
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.
|
|
|