This script is based on a program from Richard Dawkins’ The Blind Watchmaker (W.W. Norton, 1996).The program demonstrates a simplified model of asexual natural selection, starting with a String consisting of random characters and successively mutating it to produce “children” that differ from the parent. The program then selects the “best” child String (meaning the one that most closely matches the target String
methinksitislikeaweasel, a reference from Hamlet) to be the next generation’s parent. This process continues until the parent String matches the target String.
Let’s implement Dawkins’ process in Ruby.
Dawkins wrote his program to demonstrate a version of cumulative selection over time ...