Methinks it is like a Dawkins
Perhaps you’re already familiar with the idea behind METHINKS IT IS LIKE A WEASEL; it’s a simple program designed by Dawkins to demonstrate the enormous power of Darwinian evolution. He originally mentioned it in his book The Blind Watchmaker, and gave a demonstration of it in the accompanying BBC programme.
He also explains it in this shorter video (using a different phrase, but the idea is obviously the same):
(Earning that Public Understanding of Science badge. Near the end he also explains the title of another one of his books, Climbing Mount Improbable.)
Because I was bored, I’ve written a similar program (bytecode here, if you’re too lazy to compile) just now. It differs from Dawkins’ original design in a few ways.
First off, there’s only one offspring per generation, and rather than picking the best of the pool of kids, it simply picks the best of the kid or the parent.
Secondly, rather than each letter having a given chance to mutate, it just changes one letter per generation. This slows down the improvements early on, but it reduces the chances of reproduction severely messing up a nearly-correct string (my first test using random mutations took over six thousand generations just to get the final letter right; real evolution doesn’t work towards a goal it needs to get just right, so it’s not under that kind of restriction).
Thirdly, it actually kind of sucks, because you can’t really see it change as it goes. It just dumps data into the output window, and it scrolls too fast to actually follow. Still, you can scroll back a bit once it’s done.
I ran it a few times, and it seems to take about two or three thousand generations (that is, a few seconds; since this is kind of like bacterial asexual reproduction, that’s actually next to no time at all) to get from the random starting string to METHINKS IT IS LIKE A WEASEL. I could calculate how long it takes on average, but I’ll leave that as an exercise to the reader.
Post a Comment
RSS feed for comments on this post · TrackBack URL