Almost like a Whale
This page allows you to download some simple programs that simulate a simple form of selection. They were inspired by two things.
- Richard Dawkins description in "The Blind Watchmaker" of a program that uses selection to derive a recognisable English sentence from random strings of letters.
- A Delphi program by Wesley R. Elsberry, that actually implements this.
I also have included programs of, and links to, others who have implemented similar programs. This list is growing all the time, many thanks to the contributors.
Dave Wise's MONKEY.EXE as featured in Walter ReMine's book. Mr. ReMine claims it demonstrates Haldane's Dilemma, see for yourself. See Other weasels
This page was featured on the Richard Dawkins home page! A valuable site with many good links! Thanks John!
Go directly to the programs
[My weasels] [
Other weasels] [meow.bas] [whale.bas] [Submit a weasel]
Background:
One objection many people have about Darwin,s theory of evolution through natural selection, and more recent formulations of it (eg Richard Dawkins and Steven Jay Gould), is that they feel that the process of evolution causes order to come from randomness (or that some feature or behavior of an organism could not be produced by random processes e.g. you often hear or read that for [insert favorite organ or organism here] to evolve would be like throwing bricks randomly over your shoulder an expecting a house to form). This is a misreading of the actual theory. The process involves random variation of the inheritable characteristics of an organism (eg, body size, color) followed by selection by the environment. Organisms with favorable characteristics leave more surviving offspring than those with less favorable characteristics, and over time, the population evolves. A more detailed description can be found at the talk.origins FAQ site.
An interesting demonstration of how selection can build on random variation is provided by Dawkins's concept of the weasel program. Most people would be familiar with the idea that if you have a large group of monkeys in a room, each armed with a typewriter, each hitting the keys at random, that you would eventually get a line from of one of Shake spears plays typed out. The key word is eventually. In fact it would take a much longer than the age of the universe to accomplish.
What would happen, asked Dawkins, if you added in selection? He described a computer program that would produce a series of random sentences, then select the sentence that most resembled a given line from Shakespeare ("methinks it is a weasel" was the chosen line, hence the name of the program), "breed" from that sentences (with random mutations in the "offspring", select once more and repeat. You can produce a Shakespearian sentence in a surprisingly short time, (seconds on a standard PC, compared with millenia for sentences generated at random).
This is artificial, rather than natural, selection, but demonstrates vividly how selection can bring structure from randomness.
WEASLE2.BAS is a program in QBASIC 1.1 that implements Dawkins's idea. It generates a series of random sentences, selects the closest sentence to a given target sentence ("methinks it is a weasel" is the default, but you can choose others), an breeds from that sentence, inducing mutations in the offspring. Currently the only selectable items are the target sentence, and the number of offspring.
WEASLE5.BAS is a more sophisticated version which allows you to select initial population sizes, number of offspring and mutation rates. In this version ALL sentences are bred from, then a proportion "die". The probability of dying is proportional to the closeness of the strings to the target, and the amount of free population space left.
WEASLE6.BAS takes a different approach to killing the population off, and allows you to re-run scenarios. Again, it's not a realistic simulation, but does give an idea of how population variation affects the outcome.
WEASLE2.BAS, WEASLE5.BAS and WEASLE6.BAS run under the QBASIC 1.1 that comes free with DOS 5.0 and up (although it can be hard to find under Win95 and Win98, all bet are off with Win2000). They are also compatible with QuickBasic 4.x Microsoft BASIC PDS 7.x and QuickBasic 1.0 for the MAC (not 32 bit clean). If you use the /AH option in QB4.x and PDS, you can increase the maximum string population in WEASLE5 &6 (currently 250 strings).
It would require some simple editing to run under TurboBasic, PowerBasic, TrueBasic or the Linux BASIC.
Wesley R. Elsberry has produced a more sophisticated version in Delphi, that runs as a Win95 executable. If he gives permission, I will link to his site for this. He has also freely distributed a PERL script which you might like to try, and he would like copies of the logfiles generated sent to him.
Gavin Tabor g.tabor@ic.ac.uk has produced a java version of the weasel program, with an applet wrapper. Click here to see it.
Scott Maxwell s-max@pacbell.net has a different java version of the weasel program here.
Michael Kalandros kalandro@hubble.colorado.edu Has produced a version that is written for MATLAB, a math program used in engineering schools. His approach to the fitness alogrithim is a bit different to everyone else's. Click here for this code.
Peter Macinnis macinnis@ozemail.com.au has done about four variations of the weasel, using a somewhat different approach (for example in one of his programs he slows mutation rate as the string approaches its target). The code is in QBASIC, and is more easily understood than mine, but then Peter is a teacher.
- Click here for information and an example of Peters weasel code
- Click here to download the Peter's programs as a ZIP archive
David Wisewrote one of the first "weasel" programs. 8 to 10 years ago, he posted his program, MONKEY , and a write-up of his calculations on CompuServe, but he has allowed me to post them to a wider audience here. David's program has shot to fame as it is the program that neo-creationist Walter ReMine claims demonstrates Haldanes dilemma. I have posted a self extracting archive that contains the DOS program, source code in Turbo Pascal, and explanatory text, including an exposition on the probabilities. I found it ran beautifully on my 486, but gave a "runtime error 200 at 019A:0091" when run on my pentium. Pascal experts may know what that means.
- Click here for information on David's program
- Click here to download the David's programs as a self extracting EXE archive archive
There has some discussion in the newsgroups talk.origins and sci.bio.evolution on Walter Remine's claim that "weasel" style programs illustrate Haldanes dilema. The program that Mr. ReMine used to make this claim was Dave Wise's above. However, this claim is incorrect, and the following page, ReMine's Dilemma, shows why.
Howard Hershey suggested that a more representitive version would go from a valid English word to a valid English word via intermediates that are only valid English words. MEOW.BAS does this, only English words are
allowed, no abbreviations or proper names (the dictionary is still missing some entries, you try typing in all valid 3 letter English words and see how you go). MEOW.BAS runs under the QBASIC 1.1 that comes free with DOS 5.0 and up (although it can be hard to find under Win95) and all the others as above. MEOW2.BAS uses a different selection/breeding system and CAT_FLIP.BAS just flips letters randomly until CAT turns up.
If you would like to submit a weasel (or related) program, or wish to comment on these programs please email me Ian Musgrave, at reynella@mira.net.
Enter the Whale
After doing the above program the following idea came to me. The standard abbreviations for the amino acid names cover a large chunk of the alphabet, so you can
make English words out of them, thus Valine-Glutamine-Arginine-Tyrosine is abbreviated to VERY, an RNA sequence that codes for this is GUA GAA CGA UAG (remember that the
code is redundant), if you use STOP codons as spaces you can produce RNA representations of English sentences. For example the Shakespearian line VERY LIKE A
WHALE is represented by:
GUA GAA CGA UAG UAA CUG AUU AAA GAA UAA GCA UAA UGG CAU GCA CUG GAA
Val Glu Arg Tyr Stop Leu Ile Lys Glu Stop Ala Stop Trp His Ala Leu Glu
V E R Y L I K E A W H A L E
I have completed a program which takes a random RNA sequence,
and performs single base mutations, then selects for the closeness of
the "Transcript" to "VERY LIKE A WHALE" (it occurs in the same conversation as "methinks it is a weasel"). The process is very different to the WEASLE program due to the uneven redundancy of the RNA code (ie there are 6 possible codons for Ser, but only one for Trytophan, so the letter S is more stable than W). The process is slower, for a start.
Also, there are "Dead ends". The selection process is based on the closeness of the transcript to the target sentence. The difference criteria are based on the cumulative difference of the ASCII value of a each letter from the ASCII value of the target sentence. In the WEASLE2 program, getting from T to V is easy as there is is a simple intermediate(U) with a higher fitness value than T, but lower than V. When doing this at an RNA level, T (ACX) can only get to V (GUX) through intermediates such as A (GCX) or I (AUU/C/A), which have much lower fitness values. Thus Steven Jay Gould's historical contingency is demonstrated.
- Click here for the source code: WHALE.BAS
- Click here to download the program as a ZIP archive
A Whale of a peptide
Okay, if we can represent the English phrase VERY LIKE A WHALE as a peptide sequence, what does it look like. The images in the title are selected views of the peptide VERYLIKEAWHALE. I have exported the peptide structures of WHALE and VERYLIKEAWHALE as Brookhaven Protein Database PDB format files. They can be viewed with the free RasMol structure viewer. If you do not have the viewer you can download it from here. You can configure your browser to either save the files for later viewing, or view them online (eg. in Netscape, choose options | general preferences | helpers and create a new type applications\x-rasmol).
The Whale as a peptide
Chose the molecule to view, then click on the "Send" button
Downloading RASMOL 2.6 beta
These links go to the appropriate compressed executables for Windows 3.1, Windows 95, Macintosh and Unix. However, the archive seems to change the name of the storage directory fairly often, so please check. The Windows files are self extracting archives, just copy them into an appropriate directory and choose File | Run in program Manager (or the Win 95 equivalent). Mac files are bin-hexed and stuffed (choose Expand from the Stuffit menu), and the Unix files are TARED and GIZIPPED. If you need a hand extracting these file types, contact me by email. The documentation in the home directory goes on at length about recompiling and include files. Mac and Windows users do not need to do any of this, the files will run straight away once extracted, so ignore this bit.