The Weasel Applet

Most Recent Change: Fri Aug 3 08:54:32 2001 UTC.

You're either not loading Java applets or your browser doesn't support them. In either case, you're welcome to the source code.

A non-technical description of Weasel

This exhibit, which was inspired by a description of a program in Richard Dawkins's excellent book The Blind Watchmaker, demonstrates the ability of evolutionary techniques to solve enormous problems rapidly. This ability is startling; at first exposure, it is every bit as counterintuitive as quantum mechanics. Fortunately, I've found that it's possible to retrain your intuition to act as a better guide; the best way to do that is to see the techniques at work, as in this exhibit.

The applet works like this. You provide a phrase to one part of the program, the Scorer, and another part of the program (the Breeder) tries to make the Scorer happy by breeding possible solutions until it matches the supplied phrase.

The Breeder starts by making lots of random guesses and presenting each to the Scorer. The highest-scoring guess is then bred with other guesses (by combining parts of each guess) and some of the guesses are randomly mutated. The Breeder continues to breed and mutate guesses until it finds your original phrase.

Along the way, the Scorer only tells the Breeder how close each guess is to the target phrase, not what the target phrase is. The Scorer doesn't even tell the Breeder which parts of its guess are right or wrong. This is vaguely like trying to find a random spot in the galaxy, being told only how "hot" or "cold" you are after each step.

The fact that the Scorer gives the Breeder so little information emphasizes the power of evolutionary techniques. For instance, using Weasel's 68-character alphabet (all upper- and lower-case letters, plus digits and some punctuation), there are 2,042,911,512,229,885,603,274,215,297,897,150,684,236,521,591,013,376 possible phrases of the same length as the phrase "Methinks it is like a weasel" (that's about 2 million billion billion billion billion billion phrases). An exhaustive search -- systematically trying all possible guesses -- would virtually never complete; the universe would run down first. But even the simple-minded evolutionary programming techniques used in this applet typically find a solution after examining only about sixty thousand alternatives. That takes only a few minutes on my lowly Cyrix 6x86 PR-133+ running Linux (even in Java :-).

Most of the applet is independent of the particular problem it's trying to solve, illustrating the generality of evolutionary techniques. (That is, you wouldn't have to change much code to get it to find efficient travel plans instead of guessing phrases.) Though I haven't bothered, it would be simple to repackage most of the applet as a highly general problem-solver. Curious readers may wish to examine the applet's source code (in Java).


This applet's ability to guess phrases doesn't prove that evolution happened, of course. (There's plenty of evidence for that anyway, with or without my help.) But you should think of this applet when you hear someone claim that "blind chance" couldn't possibly have produced something as complex as, say, a hemoglobin molecule. When the results are subject to non-random pressures, "blind chance" can do a lot more than your intuition suggests.

(Mathematically inclined readers may be interested in a technical note about an alternate solution.)


[Support Free Speech Online] [Best Viewed with Any Browser] [Made with Emacs!] [Boycott Micro$oft] [Page Counter]