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: , , , ,

11 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).

    Agree?

  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!

  10. tdsdave says:

    I only came across this today, looking into Demski , a maths guy(?) that apparently has doubts that this works as advertised, what a nob. So I’m very late to that party, it looks like about 3yrs late to your party :)

    I occurs to me that the target, to some degree, represents the nature of an environment even in this automated version, yielding a measure by which we judge the successful adaption of the source(life) string .

    Imagine if initially the target was initially static( which it is permanently in this version), representing a stable environment in which the initial generations of life could be imagined as optimizing itself( you’d need this delay to give the “life” a chance, you’ll see why next few lines).
    After some delay of generations the target itself could start mutating( representing environmental change ) at some rate.
    Also after this delay you could start applying a more evolution type culling of children if they fail to maintain a level of correspondence above a threshold with the target.

    Depending on the new variables,
    Environmental(target) change rate and initial delay,child culling threshold I’d imagine some scenarios like the following coming out of this modification.

    The life would die having not achieved or maintained a level of correspondence above the threshold with target.
    The life chasing the target, either catching it or maintaining a positive outcome to the selection threshold.
    This implementation would be subject to the halting problem , even identical strings would not stop the algorithm because the threshold test would still take place on subsequent generations, either the target or the source might mutate, and some time later the correspondence might dip below the threshold and the source would be culled.
    It would only halt on the death of the source , that’s the environment changes and none of it’s offspring adapt to maintain the threshold level. So the real metric coming out of this could only be how long the life lasts.
    Going write this version myself, but thought I’d share the thought having found this page. Smacks of a mix of the game of life and the weasal algorithm, probably not orignal

Leave a Reply