This webpage contains some source files accompanying the article
Berghman, L., Goossens, D. and Leus, R. (2009). Efficient solutions for Mastermind using genetic algorithms. Computers & Operations Research, 36, 1880-1885. (pdf) (DOI)
The proposed genetic algorithm was coded in Borland Delphi 6 using Microsoft Visual Studio 2005. Let N represent the number of colors and P the number of positions. The following files are implementations of the genetic algorithm on four different datasets:
P = 4, N = 6 (for all 1296 codes)
P = 5, N = 8 (for a sample of the codes)
P = 6, N = 9 (for a sample of the codes)
P = 8, N = 12 (for a sample of the codes)
The output has the following structure: for each game, one block consisting of multiple lines is produced. The first line of each block is the secret code, the following lines are the different guesses that are made. The last guess always equals the secret code.