Documentation for Genetic Snowflakes

Example of main screen (pfeiffer_local.html)

The example screen shot shows a mixture of sterile initial flakes (white) and genetically determined xbm images (black). The browser started with 25 sterile flakes. It is in the process of replacing these by down loading 25 flakes from the global population of flakes previously saved by other users. It has just loaded the thirteenth (number 12) chromosome from the network and has just rendered the tenth (number 9) as xbm image. This leaves 15 white flakes to go. It can take several minutes to down load them all. (The number of flakes can be reduced, or indeed increased, by using pfeiffer_params.html before the simulation is started.) Note beauty means different things to different people. The large seahorse shape was saved by a user on 9 February 2004 at 12:57:54. The flying menus can be used to delete ugly flakes before they get a chance to breed and produce children.

By default the "Age before breeding" parameter is set sufficiently high that all flakes will be loaded before any can start breeding. This can be reduced (but should always be bigger than, say, 50).

System Overview

The system evolves snow flakes and displays them falling down the screen of a www browser. The snow flakes are described by a Lindenmayer system grammar. As they flutter down the screen they are subject to random encounters and changes which may effect their grammar. In which case their new shape is drawn on the screen. The user can save pretty flakes.

Overview of the browser based version of Pfeiffer

The local system is similar to the original version but has many advantages. The major differences are:


If enabled, pfeiffer_local.html will read initial genetic makeup (chromosome) for up to 20 individuals from a cookie called LindenMayerSystemJavaScript+i on your machine.
If this fails, pfeiffer_local.html will try and read it from the network, via seed.
If this too fails, a default initial seed held in pfeiffer_params.html is used.

Cookies are saved for a year.


Javascript program run by your browser.

Flying Menus

screenshot Delete Save Example of main screen, showing flying menues.

The menus appear when a mouse is dragged over a flake. This screen shot was taken, just after flake 1 (lower left) had been deleted and flake 3 (lower center) had been saved. The mouse can also be used to move flakes about the screen.

Individuals are copied, saved or deleted with the individual's menu.

The menu will appear when the simulation is paused and the mouse is dragged across the individual.
If cookies are enabled, the cookie for that individual is updated.
Also pfeiffer_local.html will convert the genetic material to a string of hexadecimal digits (hexMe) and try and pass it across the network to harvest.

An individual snow flake can be dragged and dropped elsewhere on the screen using the mouse. Allowing the user to line up potential mating pairs.

Currently (July 2003) mutation is disabled and all new individuals are created by crossover. Just as when the program starts, a new XBM bit map is created after every new individual chromosome is created. Some browsers allow colour PNG images. New babies are highlighted in light blue.


Each chromosome is parsed in pfeiffer_local.html (This process also removes duff alleles.) Defaults (specified by pfeiffer_params.html) are given for those parameters which are omitted or are malformed. The clean parameters are passed to routines in lsys.js D01 expands the L-system grammar to a series of graphics commands. evalstring() executes them to give a pixel bitmap, which can be rotated and projected onto the X-Y plane by rotate(). xbm_pixmap converts the pixmap into an XBM file which the browser can display. In order to prevent the system hanging up when presented with excessively complex individuals, a time out is applied to each stage.


In the case where the user does not wish to give feed back a fitness function is given. This is applied only after an extended period. (The user can set this parameter). This gives the user time to use the menus to decide on each flake's fate.

The fitness function rewards novelty and complexity. A flake produced by crossover cannot enter the population unless it is unique. (Cloning by the user, of course, ignores this requirement). Uniqueness is checked at three levels; the chromosome, graphics commands and pixel bitmap levels.

Each flake will only accept a potential mate it encounters (ie comes within mate radius of) if it appears to be of above average fitness.

From birth, each individual maintains a (noisy) estimate of the median fitness of "mature" individuals in the population. This is simply the fitness of the last "mature" guy it met. Ie only improvements are accepted.

Following mating, both parents are unable to mate for a period proportional to the cpu resources (in milliseconds) needed to create their child. (In general still born flakes which fail the uniqueness check will require little cpu time and so impose little penalty.) Note even with a small penalty, parents are unlikely to mate again immediately because they will have updated their estimates of average fitness to that of the other parent. Repeat mating is possible only if another mature flake with lower fitness is encountered.

Incest is also unlikely since a child must become mature. Random movements will tend to ensure it is far from its parents and their other offspring before it becomes mature.

The rest of the local and server based systems are similar to each other.

Genetic Representation

lsys.js etc are based on lsys.perl The chromosome is treated as a series of command parameters (defaults are shown in brackets):-

(The hall of fame contains many examples).


Host program which returns a randomly selected individual chromosome from seed.pop and gives it to pfeiffer_local.html See function fetchURL.


Program on host which collects saved individuals and puts them in seed.pop See function fetchURL.


File on host machine at UCL. Holds individuals previously saved.


seed.html frozen snapshot of the population. It is generated by nawk script seed.awk acting on file seed.pop


The hall of fame is generated by nawk script halloffame.awk acting on file log.


Hall of fame


I would like to thank Birger Nielsen for use of his perl Lindemayer interpretter. David Blackledge for his JavaScript Analog Clock. Roger E. Critchlow Jr. for pnglets.

Maarten Keijzer and the much put upon reviewers. David Corney and Emma, Song Hu. Joao Oliveira, Mel Slater and Jano van Hemert. Jorge Tavares, Ernesto Costa, Francisco Pereira, Sara Silva.

Many URLs have been raided, including these:- Mozilla Phil Reeve for en Hex.

Source Code

Its probably best to contact me directly if you would like the source code. It can be directly loaded from via your browser, of course. However an release kit can be found here.

W.B.Langdon $Revision: 1.9 $ 12 April 2004 (27 Aug 2006)