Hacker News new | past | comments | ask | show | jobs | submit login
Show HN: Richard Dawkins’ Biomorphs Implemented in JavaScript (emergentmind.com)
117 points by matt1 on May 30, 2014 | hide | past | favorite | 18 comments



Neat! I also liked some of the other Javascript demos on this site, like http://www.emergentmind.com/elementary-cellular-automata .

Heres's also a fun little video of vintage Dawkins showing off his program: http://www.youtube.com/watch?v=oDxaCJmlIGo

I have fond memories of programming variants of Dawkin's Biomorphs program in my early teens. I even sent him one of my creations, to which a grad student of his replied with kind encouragement!


Thank you for the kind words.

I have other JavaScript-based emergence and artificial life projects planned so if you liked these, you should sign up for the mailing list to get notified when new projects are released: http://www.emergentmind.com/newsletter

If anyone reading this finds these topics fascinating as well I'm always down for a chat: matthew.h.mazur@gmail.com or @mhmazur - cheers!


What I like about that Dawkin's video is that it appears he's using an Amiga. :)


I vaguely remember in Dawkins' book that he said he was going to put a touch-sensitive screen near some flowers to see if any of the biomorphs would attract bees. The idea was that the biomorphs would evolve to be ever more pleasing to bees, and it would be interesting to see what patterns they took. Does anyone else recall this, or is it a figment of my imagination? I don't suppose anyone has tried this? Could be fun to try with an iPad.


This sounds like a great project! Worth bearing in mind though that computer screens only output in RGB, whereas the colour vision of bees is shifted to that of people; it's more G-B-UV than RGB.


Absolutely! Of course, one could let colour be another variable, and we might expect they'd be completely oblivious to red.


Love it!

I wrote a small script that evolves them based on a scoring function, paste in your console and run evolve(1000, score)

    function evolve(numGenerations, scoringFn, stepInterval) {
      var children = document.querySelectorAll('[id*=child]'), generation = 0
      if (stepInterval == null) stepInterval = 10

      function run() {
        var i, child, ctx, data, score, winner, winningScore = -Infinity
        for (i = children.length - 1; i >= 0; i--) {
          child = children[i]
          ctx = child.getContext('2d')
          data = ctx.getImageData(0, 0, 318, 148)
          score = scoringFn(data)
          if (score > winningScore) {
            winningScore = score
            winner = i
          }
        }
        children[winner].click()
        if (++generation < numGenerations) setTimeout(run, stepInterval)
        // console.log(winner, winningScore)
      }

      run()
    }

    function score(imageData) {
      var i, r, g, b, rv = 0,
          data = imageData.data, l = data.length
      for (i = 0; i < l; i += 4) {
        r = 255 - data[i]
        g = 255 - data[i+1]
        b = 255 - data[i+2]
        a = data[i+3] / 255
        rv += (r + g + b) * a
      }
      return rv
    }


By the way, anyone who is new to the whole artificial life area should also take a look at Chris Adami's Avida: video [0], site [1]. Some Nature papers even came out of it, e.g. [2].

I'm going to shamelessly plug two abandonware projects of mine, being an agent-based neural network evolution sim [3] and a spatial game theory lab [4]. These might be interesting to people who like this kind of stuff.

But there's a huge amount of other stuff out there, e.g. projects like DarwinPond and prolific researchers like Martin Nowak [5].

[0] http://www.youtube.com/watch?v=ouF8wKxXWFQ

[1] http://avida-ed.msu.edu/

[2] http://adamilab.msu.edu/wp-content/uploads/Reprints/2003/Len...

[3] https://github.com/taliesinb/floatworld/wiki

[4] https://github.com/taliesinb/spatial-game-theory/wiki

[5] http://www.ped.fas.harvard.edu/publications/


I used to be really into artificial life simulations. Here are some directories to tons of projects like that. You will need to use web archive for a good deal of this stuff though. And a recent update of Java seems to have broken a lot of the older web based ones.

"Artificial life links": http://www.alcyone.com/max/links/alife.html

International Society for Artifical Life links page: http://alife.org/links.html

Zooland Artificial Life links page: https://sites.google.com/site/myzooland/

My favorite is Darwinbots, which has a lot more physics and features and things to tinker with than the average simulation. You can also directly program the bots to do whatever.


Intelligently designed! Congrats!


It does not take that many generations to select for traits when the diversity is already in place. This is wonderfully illustrated by these biomorphs. But when you are waiting for an innovation to appear---something not yet in the gene pool---you will have to wait a very long time. The spontaneous occurrence of innovation is exceedingly rare, and you will have to wait over Evolutionary timescales to see it happen.


This is really cool. Somebody already asked for a reverse button, how about a way to playback the evolutionary history of your biomorph (animated)?


Anyone else keep converging to this shape?

https://i.imgur.com/aI0zDw9.png


Ah yes. Here's what's happening:

When the biomorph gets too big for its canvas, I automatically reduce its branching depth until it's not too large. If you keep clicking on children that make it evolve towards larger entities, eventually it will shrink and look something like the biomorph in your screenshot.

Someone suggested that rather than automatically reduce its size, I should just make them unclickable (ie, you can only choose a child that fits within the canvas).

What do you think? Any other ideas?

Edit: I just updated the implementation so that instead of automatically reducing the child biomorph's size if it's too large, it simply becomes unclickable (you'll also get an notice if you try to click it). Should be a bit better -- thanks for the nudge!


This reminds me of programming something from A. K. Dewdney's Armchair Universe on my Amiga in the late '80s. I think it originally appeared in Scientific American. It started off with bugs that just sort of juggled, but the ones that survived eventually glided around eating things.


Very cool! Can you implement a reverse button to store the last few sets? I notice that sometimes there is a mutation that shows up in all the offspring at once.



Are these creations manipulations of binary trees?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: