Methinks it is [still] like a weasel

Full screen version

A couple of years ago I created an online Javascript version of Dawkins’ Weasel program. I was poking around at the code today and realised that it wouldn’t be too much work to remove some of its limitations to allow it to replicate the full 28 character phrase that Dawkins used.

If you’re unfamiliar with why anyone would want to make an program like this, take a look at the original post where I explain how genetic inheritance combined with natural selection gives vastly different results to the mistaken creationist view of evolution being a ‘monkeys with typewriters’ kind of randomness. (by the way, if you change the settings so that there is only one child per generation the program will enter ‘monkeys-with-typewriters mode’).

The main differences in this version are:

  • You can now hide or show all the mutant children that were not selected
  • You can use up to 30 uppercase A-Z letter plus spaces
  • There’s a new column that shows how many letters matched (so you can see how it occasionally slips back with higher mutation rates – contrary to what William Dembski would have you believe)
  • I’ve improved the performance slightly.

Tags: , , , ,

10 Responses to “Methinks it is [still] like a weasel”

  1. …you are the ‘tech-o skepto’! :)

    Can you tell me how the ‘target’ function works? Surely (I don’t suspect you’d disagree), this is a case of the programme being discontinuous with the strictly ‘blind’ watchmaker of natural selection, yes? Not in the sense that we can see a phrase (or a watch) after the fact, which we can, but in the sense that the process has an inherent goal of making a phrase (or a watch) before the fact, which one does (the programme) and one doesn’t (natural selection).


  2. Damian says:

    Ah, sorry, I just read and replied to your post over on your blog before reading this one. Quite right. This isn’t an accurate evolution simulation because it knows the ‘goal’ to aim for. In real evolution it’s the environment that does the ‘selecting’.

    But it’s very handy for showing how evolution isn’t at all like the random ‘monkeys with typewriters’ process that some creationists have tried to make it out to be.

  3. Damian says:

    Heh, I’ve just looked at the original post and you asked:

    I’m curious about the concept of a ‘target phrase’? Biologically speaking, there are no ‘target’ organisms correct? Only organisms which survive/replicate in the current environment, right? Might just be semantics (I’m always picky with words!)? :)

    Where David Winter replied,

    Yeah, Dawkins was specifically addressing the “if a hurricane blew through a Boeing shed you wouldn’t get a 747 argument”, the weasel algorithm is simply meant to show that random change + cumulative selection is orders of magnitude more creative than chance alone.

    Deja vu? :)

  4. Deja vu? :D

    Yeah, just a tad embarrassing that I asked pretty much exactly the same question back then! :)

  5. Damian says:

    I’m going to re-post this in another two years as a test ;)

  6. AskAnAtheist says:

    Holy COW that’s fantastic!! I have to admit that’s the very first time I’ve seen a genetic algorithm written in JavaScript. Well done, mate!

    (nice coding style by the way – very elegant!)

  7. tctwc says:

    Hello, Damian.

    First thing first – thanks for the effort put into this simulation.

    I also have a suggestion to simulate “enviromental selection” rather than artificial selection.

    Suppose we want to simulate the evolution of ANY (not predefined) english phrase from random string.

    The algorithm will also start with random string of characters (letters+spaces) and generate N children with M% mutations.

    Now as “enviromental selection measure” used to select the “surviving” child let us take some statistical measure of likeness of this string to an english phrase. For example, it can be frequency distribution of letters.

    Finally, what will be the stopping trigger (i.e., the test that will conclude that current survivng child is some english phrase)? The simplest solution that I can think of now is to perform a Google search on it and check if it returns any results. Of course, successful search does not guarantee that this string is actually an english phrase, but at least that it has some sense (evolved from randomness!), and the more results are returned, the more sure we can be.

    I suppose my dusted programming skills would be sufficient to code this thing by myself (excluding, maybe, calls to Google) but I am not sure when and if I can actually do it.

    I want to share it anyway, maybe you could add some suggestions or actually place some modified version of it here for our tinkering ;)

  8. hey there sir,
    just read this and it made me remember this post – I thought it was a helpful – heck, even essential – addition to the conversation.

  9. Damian says:

    Merry Christmas to you and yours Dale!
    Yeah, ‘monkeys with typewriters’ is a horrible analogy (even allowing for four letters) because it doesn’t account for the capturing of successful ‘words’, ‘sentences’ or ‘chapters’ and using them as starting points for the next iteration.

    The only time I’ve ever come across the analogy is in the hands of creationists (perhaps intentionally) misrepresenting evolution.

    Enjoy your holidays!

Leave a Reply