The mink program

mink

The weasel program by Richard Dawkins illustrates how random variation plus cumulative selection can drive the evolutionary process much faster than chance alone.  The program converts a string of 28 random characters into “METHINKS IT IS LIKE A WEASEL” in a short period of time, not the many times the age of the universe that would be required by pure random chance.  A string’s resemblance to the target phrase is used as a measure of its adaptation to its “environment.”  This specific long-term goal is seen by some as a liability, since nature has no such goal.  More open-ended programs have been written that generate graphics that may be selected for their resemblance to any hypothetical shape.

Like a smaller-scale version of weasel, mink begins with a string of eight characters; but instead of a specific goal, it selects variants based on their resemblance to any of 29,766 eight-letter words.  The word list is analogous to a multidimensional set of environmental conditions; random variation can take the selection process in any of a large number of directions, and the outcome is not predetermined.  The only criterion for fitness is, “To what degree does the string resemble a word?”

A summary of the algorithm:

The user sets the population limit, the number of offspring per individual, and the mutation rate per character.

The script generates a string of eight random characters (generation 0).

The strings reproduce freely until the population reaches its limit.

From then on, each string in each generation is evaluated by how many characters correspond to any word in the word list.

The most-fit strings reproduce to replace the previous generation.  The number of reproducing individuals = population / offspring per individual.

The script runs until one or more strings in a generation match a word in the list.

(Alternately, the user may use a longer phrase as a one-member “word list” like the original weasel program.)

Notes:

Even though the character strings are shorter, mink runs slower than weasel because every string in the population must be compared to potentially every member of the word list.

The word list is the words common to the Official Tournament and Club Word List and Collins Scrabble Words, and has not been censored for appropriateness for any specific audience.

Correct characters are not “locked” and may become incorrect in subsequent generations.

Note that too high a mutation rate may prevent the progress of a long phrase.

A small number of offspring and a large population will run slowly.

Probability of generating a specific eight-letter word at random:  1/268 = 1/208,827,064,576.

Probability of generating “METHINKS IT IS LIKE A MINK” at random:  1/2726 = 1/(1.6×1037)  (at one million per second, 3.7×1013 × the age of the universe).

In progress, the script orders the population of strings by fitness (the number of characters that correspond to a word, or the phrase), then displays the first one as an example; subsequent displayed strings are not necessarily descendants of the previous ones.


population limit: 1000

offspring per individual: 10

mutation rate per character: 0.01

    (letters and spacebar only; will be converted to upper case if necessary)

run | cancel

 

show the word list


Please visit russellcottrell.com.